`.pyc` file in zipapp can be marked as stale if opened in a different timezone than the one it was created in
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 35.9k
- PR マージ指標
- PR 指標を取得中
説明
Bug report
Bug description:
_get_mtime_and_size_of_source uses localtime rather than UTC --- in a zipapp, if the pyc was created in a timezone that is different than the timezone of the computer that it is being run on, it can be marked as 'stale', even though it shouldn't be --- for example, if the source file was last modified at 3:30 EST, that 3:30 EST will be stored in the pyc file as a Unix timestamp. However, if the zipapp is then transferred to a computer running PST, the modification time of the source file will be read from the zip file as 3:30 PST in unix time (through time.mktime), which will obviously be different than the 3:30 EST read from the pyc file directly (since it is never passed through time.mktime).
This seems to be because zip files do not store timezones with mtime, so Python is forced to interpret it as local time.
CPython versions tested on:
3.11, 3.13
Operating systems tested on:
Linux, macOS
Linked PRs
- gh-143868
- gh-143953
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
_get_mtime_and_size_of_source から始め、zipapp ソースの mtime が、pyc のタイムスタンプとは異なり time.mktime でどのように変換されるかを追跡します。Linux または macOS 上の Python 3.11 または 3.13 で説明されているタイムゾーンの違いを再現し、その後、タイムゾーン間で転送された pyc が誤って古いものとしてマークされなくなったことを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- backend
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100