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

Add __slots__ to typing._NotIterable #92570

Merged
merged 1 commit into from May 10, 2022

Conversation

AlexWaygood
Copy link
Member

@AlexWaygood AlexWaygood commented May 9, 2022

4739997 added typing._NotIterable as a mixin to typing._SpecialForm, which defines __slots__ as an optimisation technique. However, typing._NotIterable does not define __slots__, meaning the the __slots__ declaration on typing._SpecialForm is now meaningless, since all base classes must define __slots__ in order for a __slots__ declaration on a subclass to have any effect.

This PR adds __slots__ = () to typing._NotIterable.

Copy link
Member

@gvanrossum gvanrossum left a comment

LGTM. (Though didn't we once try to assess the effect of those slots and failed to find any?)

@AlexWaygood
Copy link
Member Author

@AlexWaygood AlexWaygood commented May 9, 2022

LGTM. (Though didn't we once try to assess the effect of those slots and failed to find any?)

Those were different slots I think :)

@serhiy-storchaka serhiy-storchaka merged commit eef47d5 into python:main May 10, 2022
12 checks passed
@miss-islington
Copy link
Contributor

@miss-islington miss-islington commented May 10, 2022

Thanks @AlexWaygood for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒🤖

@bedevere-bot
Copy link

@bedevere-bot bedevere-bot commented May 10, 2022

GH-92617 is a backport of this pull request to the 3.11 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this issue May 10, 2022
(cherry picked from commit eef47d5)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
@AlexWaygood AlexWaygood deleted the notiterable branch May 10, 2022
miss-islington added a commit that referenced this issue May 10, 2022
(cherry picked from commit eef47d5)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
expert-typing skip issue skip news type-bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants