-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
tempfile.SpooledTemporaryFile: inherit from IOBase on 3.11 #7802
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer us to use a wordier-but-more-readable alias name, like _SpooledTemporaryFileBase
, rather than _STFBase
which feels a bit opaque.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like in typeshed, we've always pretended that SpooledTemporaryFile
has readable()
and seekable()
methods on Python <3.11 (see the comment on line 330), even though they don't at runtime. This is because SpooledTemporaryFile
inherits from IO
in typeshed, and IO
has readable()
and seekable()
as abstract methods.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about the new detach()
method? https://github.com/python/cpython/pull/29560/files#diff-6553a99f3ae04c9fc9c2349ac27037bfe3b274d5ca54d5800d9c5b5f11e29d21R813
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
stdlib/tempfile.pyi
Outdated
# It does not actually derive from IO[AnyStr], but it does mostly behave | ||
# like one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment should probably be moved down above the class itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
1 similar comment
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
hm, I expected unused stubtest allowlist entries. I'll look into that in a followup PR. |
python/cpython#29560