pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/python/cpython/pull/152452

a="all" rel="stylesheet" href="https://github.githubassets.com/assets/github-eab9c5888b163e42.css" /> gh-152445: fix zipfile.writestr() ignoring strict_timestamps when SOURCE_DATE_EPOCH is set by Lohitha0-0 · Pull Request #152452 · python/cpython · GitHub
Skip to content

gh-152445: fix zipfile.writestr() ignoring strict_timestamps when SOURCE_DATE_EPOCH is set#152452

Open
Lohitha0-0 wants to merge 3 commits into
python:mainfrom
Lohitha0-0:gh-152445-zipfile-strict-timestamps-source-date-epoch
Open

gh-152445: fix zipfile.writestr() ignoring strict_timestamps when SOURCE_DATE_EPOCH is set#152452
Lohitha0-0 wants to merge 3 commits into
python:mainfrom
Lohitha0-0:gh-152445-zipfile-strict-timestamps-source-date-epoch

Conversation

@Lohitha0-0

@Lohitha0-0 Lohitha0-0 commented Jun 27, 2026

Copy link
Copy Markdown

Fixes #152445.

ZipInfo._for_archive() (introduced in gh-91279) sets date_time from
SOURCE_DATE_EPOCH or the system clock, but did not apply the
strict_timestamps=False clamping that ZipInfo.from_file() performs.

This caused writestr() to raise struct.error when
strict_timestamps=False and SOURCE_DATE_EPOCH (or the system clock)
was set to a date before 1980, instead of silently clamping to 1980-01-01.

The fix mirrors the existing clamp logic in from_file().

@bedevere-app

bedevere-app Bot commented Jun 27, 2026

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@python-cla-bot

python-cla-bot Bot commented Jun 27, 2026

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

@Lohitha0-0 Lohitha0-0 force-pushed the gh-152445-zipfile-strict-timestamps-source-date-epoch branch from 434f28b to 974fa2b Compare June 27, 2026 19:04
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.

zipinfo: strict_timestamps=False fails in combination with SOURCE_DATE_EPOCH

1 participant

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy