Skip to content
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

os.PathLike is missing __slots__ #104898

Closed
barneygale opened this issue May 24, 2023 · 1 comment
Closed

os.PathLike is missing __slots__ #104898

barneygale opened this issue May 24, 2023 · 1 comment
Labels
3.13 bugs and security fixes type-bug An unexpected behavior, bug, or error

Comments

@barneygale
Copy link
Contributor

barneygale commented May 24, 2023

Per @AlexWaygood:

All the ABCs in collections.abc deliberately define __slots__ for this very reason: so that other classes can subclass those ABCs and still be able to use the __slots__ machinery to block the creation of instance dictionaries.

Linked PRs

@barneygale barneygale added type-bug An unexpected behavior, bug, or error 3.13 bugs and security fixes labels May 24, 2023
barneygale added a commit to barneygale/cpython that referenced this issue May 24, 2023
@barneygale
Copy link
Contributor Author

Fixed in 3.13: #104899 / bd1b622

barneygale added a commit to barneygale/cpython that referenced this issue May 29, 2023
Subclassing `os.PathLike` rather than using `register()` makes
initialisation slower, due to the additional `__isinstance__` work.

This partially reverts commit bd1b622.
barneygale added a commit to barneygale/cpython that referenced this issue May 29, 2023
Subclassing `os.PathLike` rather than using `register()` makes
initialisation slower, due to the additional `__isinstance__` work.

This partially reverts commit bd1b622.
barneygale added a commit that referenced this issue May 29, 2023
Subclassing `os.PathLike` rather than using `register()` makes
initialisation slower, due to the additional `__isinstance__` work.

This partially reverts commit bd1b622.

Co-authored-by: Alex Waygood <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.13 bugs and security fixes type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant