Skip to content

Conversation

@VanshAgarwal24036
Copy link
Contributor

ZIP (DOS) timestamps do not include timezone information, but CPython currently
interprets them as local time via time.mktime(). This can cause .pyc files to be
incorrectly marked as stale when a zipapp is created and run in different
timezones.

This change uses calendar.timegm() so ZIP source timestamps are interpreted with
UTC semantics, matching .pyc timestamp handling.

Fixes gh-141431

@picnixz
Copy link
Member

picnixz commented Jan 18, 2026

If the tests are failing please do not open a PR or fix them or make it a draft. I will be closing it.

@picnixz picnixz closed this Jan 18, 2026
@VanshAgarwal24036 VanshAgarwal24036 deleted the gh-141431-zip-utc-mtime branch January 19, 2026 03:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.pyc file in zipapp can be marked as stale if opened in a different timezone than the one it was created in

2 participants