-
Notifications
You must be signed in to change notification settings - Fork 30
Make collections.abc.* generic #5
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
|
Try running |
|
The test failure was due to protocol runtime attribute compatibility checking. I disabled checking for @runtime_checkable
class Custom(collections.abc.Iterable, Protocol):
def close(self): ...
class B: # would now require an implementation of __class_getitem__
def __iter__(self):
return []
def close(self):
return 0 |
gvanrossum
left a comment
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.
You said that __class_getitem__ is inherited -- maybe you need fewer of them?
Yep! Done. |
gvanrossum
left a comment
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.
Awesome! You left a few blank lines, in, but I'll take them.
….1 (pythonGH-24289) RFC 8018 superseded RFC 8018. Automerge-Triggered-By: GH:tiran
... and add tests for them.
I also removed
__class_getitem__fromcollections.UserDict/collections.UserList, since those inherit fromcollections.abctypes (which is a nice test inheritance works for these types)!'I didn't import
types.GenericAliasin_collections_abcsince this seems to be on the hot path for startup, and I figured that would be bad.