-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
add new pathlib base classes for 3.13 #12937
base: main
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
Is there a way to make mypy-primer run for 3.13 for this MR? If there's anything off, that's where it'd show up. |
This comment has been minimized.
This comment has been minimized.
stdlib/pathlib/_abc.pyi
Outdated
def is_socket(self) -> bool: ... | ||
def samefile(self, other_path: StrPath) -> bool: ... | ||
|
||
# Adapted from builtins.open |
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 don't know if we should require all implementations of this ABC to duplicate this stack of overloads. Not sure what the alternative would be, though.
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 hadn't considered that aspect when copying it over. I think the alternative is to define only the most generic form of open on the base class, and implementations can have more specific overloads as needed. I'll update the MR for that.
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.
stubtest didn't like that... I thought it would work based on a simplified test I did locally, but possibly I misunderstood something. I'll need to look at it later, so I'll put this in draft for now.
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.
Also the same concern possibly applies to the overloads on ParserBase. I copied the definitions in the MR right now for that class from the versions that exist in posixpath.pyi.
This comment has been minimized.
This comment has been minimized.
Adding the default value to the final overload makes the pipeline pass, and shouldn't affect anything overall due to mypy's "pick the first match" handling of overloads. |
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
3.13 adds these new (private for now) base classes for pathlib which are not actually ABCs despite the module name.