python / python/cpython

`zipfile`: docs should document what `ZipInfo.date_time` actually is

Open
#133,125 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

3.13 3.14 docs stdlib
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

Documentation

Currently, the documentation for ZipInfo.date_time is:

The time and date of the last modification to the archive member. This is a tuple of six values:
...
Note: The ZIP file format does not support timestamps before 1980.

This should be extended/clarified to define which date/time is meant (which currently is only hinted by the does not support timestamps before 1980.

The ZIP format supports for multiple timestamps:

  • there's the last mod file time and last mod file date in the central directory (see chapters 4.3.7 and 4.4.6)
  • but also various times (e.g. for NTFS and UNIX) as part of the extra fields (see e.g. chapter 4.5.7).

The latter may e.g. support times before 1980, higher resolutions and time zones.

Right now it seems not strictly defined what .date_time actually returns - from what I can see from the code, it's the one from the central directory - but that could in principle be just an implementation detail and a future version of zipfile could e.g. use the extra fields if present.

Thus it would be nice, if the documentation could specify, whether .date_time is always meant to be the time from the central directory, or whether this could change.

Thanks,
Chris.

Linked PRs
  • gh-136082
  • gh-138076
  • gh-138077

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked zipfile.ZipInfo.date_time documentation and inspect the existing zipfile implementation that supplies this attribute. Update the documentation to state which ZIP timestamp it represents and how that relates to other timestamp fields, then verify the rendered wording and documentation checks.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.