Title: `.pyc` file in zipapp can be marked as stale if opened in a different timezone than the one it was created in · Issue #141431 · python/cpython · GitHub
Open Graph Title: `.pyc` file in zipapp can be marked as stale if opened in a different timezone than the one it was created in · Issue #141431 · python/cpython
X Title: `.pyc` file in zipapp can be marked as stale if opened in a different timezone than the one it was created in · Issue #141431 · python/cpython
Description: 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 ...
Open Graph Description: 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 th...
X Description: 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 th...
Opengraph URL: https://github.com/python/cpython/issues/141431
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`.pyc` file in zipapp can be marked as stale if opened in a different timezone than the one it was created in","articleBody":"# Bug report\n\n### Bug description:\n\n`_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`).\n\nThis seems to be because zip files do not store timezones with mtime, so Python is forced to interpret it as local time.\n\n### CPython versions tested on:\n\n3.11, 3.13\n\n### Operating systems tested on:\n\nLinux, macOS\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-143868\n* gh-143953\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/DUOLabs333","@type":"Person","name":"DUOLabs333"},"datePublished":"2025-11-11T23:37:05.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/141431/cpython/issues/141431"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:31122699-ac30-29a1-62cd-068505371f13 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 98F2:3198BA:25CEF71:323E040:696EFE2C |
| html-safe-nonce | f0086a659d13439908c486336b9dd3beaa7d4f0c5a08435d4954262645d0f706 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5OEYyOjMxOThCQToyNUNFRjcxOjMyM0UwNDA6Njk2RUZFMkMiLCJ2aXNpdG9yX2lkIjoiODI3OTcxNjU5NTE0MTgzMjEyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 80302b787b7de124e1938cf6ce1aace678c9f5fd4250a2b8c6643a9406018c85 |
| hovercard-subject-tag | issue:3614275154 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/141431/issue_layout |
| twitter:image | https://opengraph.githubassets.com/deafb5a8c6ae7418be6ff2015e29802f5a25b1a309ff23bd3570c3cfb7352d54/python/cpython/issues/141431 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/deafb5a8c6ae7418be6ff2015e29802f5a25b1a309ff23bd3570c3cfb7352d54/python/cpython/issues/141431 |
| og:image:alt | 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 th... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | DUOLabs333 |
| hostname | github.com |
| expected-hostname | github.com |
| None | b278ad162d35332b6de714dfb005de04386c4d92df6475522bef910f491a35ee |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 39aed5006635ab6f45e6b77d23e73b08a00272a3 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width