Closed ncoghlan closed 1 month ago
I believe making the typeshed stub align with the stdlib docs is the right answer here, so I've submitted a PR for that.
For future reference: It's okay to just send PRs in straight-forward cases like this. We don't require an issue for each PR.
Thanks.
In this case, I wasn't sure if I had diagnosed the problem properly, hence filing the issue first (it was only after writing it up clearly enough to file the issue that I became sufficiently convinced of my own reasoning to send the PR. In particular, realising that stub autogeneration would have emitted the stricter type due to the way the field is initialised).
The typeshed stub types
TarInfo.mtime
strictly asint
(presumably because it gets initialised to0
in the standard library code). The Python stdlib docs type it asint|float
. The implementation does supportfloat
values in this field as it coerces withint()
when serialisingmtime
to the tar archive field.This isn't a blocker for anything (since type checkers can be satisfied by making the truncation explicit in the code setting the
TarInfo.mtime
field), but the discrepancy with the stdlib docs made the issue seem worth filing.