-
-
Notifications
You must be signed in to change notification settings - Fork 2k
tarfile.TarFile has several missing overloads #14168
Copy link
Copy link
Open
Labels
help wantedAn actionable problem of low to medium complexity where a PR would be very welcomeAn actionable problem of low to medium complexity where a PR would be very welcomestubs: false negativeType checkers do not report an error, but shouldType checkers do not report an error, but should
Metadata
Metadata
Assignees
Labels
help wantedAn actionable problem of low to medium complexity where a PR would be very welcomeAn actionable problem of low to medium complexity where a PR would be very welcomestubs: false negativeType checkers do not report an error, but shouldType checkers do not report an error, but should
Fields
Give feedbackNo fields configured for issues without a type.
Right now
TarFile.__init__is defined as:typeshed/stdlib/tarfile.pyi
Lines 128 to 132 in c7e29ec
Which is not exactly right, because there's a case when
nameandfileobjare bothNoneat the same time. And this will lead to runtime errors:Right now mypy does not raise any errors for this broken case: https://mypy-play.net/?mypy=latest&python=3.12&gist=7452d274249fafba1f8a16565d5486c6
We need either
nameorfileobj, they can be bothNoneat the same time. So, we need to add overloads.There are several other methods that needs to be updated like
openandtaropen, maybe others.