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 a few more tests for interactions between typing.Protocol and typing_extensions.Protocol #244

Merged
merged 4 commits into from
Jun 17, 2023

Conversation

AlexWaygood
Copy link
Member

I was looking at lines like these:

# Determine if this is a protocol or a concrete subclass.
if not cls.__dict__.get('_is_protocol', False):
cls._is_protocol = any(b is Protocol for b in cls.__bases__)

# ... otherwise prohibit instantiation.
if cls.__init__ is Protocol.__init__:
cls.__init__ = _no_init

And realised that I wasn't at all sure how the interaction between typing.Protocol.__init_subclass__ and typing_extensions.Protocol.__init_subclass__ would work out. It looks to me like it's fine, but I thought a few extra tests might be good anyway.

@AlexWaygood AlexWaygood marked this pull request as draft June 17, 2023 13:11
@AlexWaygood AlexWaygood marked this pull request as ready for review June 17, 2023 13:17
@AlexWaygood
Copy link
Member Author

AlexWaygood commented Jun 17, 2023

(There is an edge-case bug there, actually. But I'll investigate/fix it in another PR. If it can be fixed.)

Copy link
Member

@JelleZijlstra JelleZijlstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks.

Should I merge or wait for the bugfix you alluded to?

@AlexWaygood
Copy link
Member Author

AlexWaygood commented Jun 17, 2023

Merge this -- the bug probably isn't fixable? I think we'll have to document it. Writing up an issue now :/

@JelleZijlstra JelleZijlstra merged commit fd1f853 into python:main Jun 17, 2023
@AlexWaygood AlexWaygood deleted the more-proto-tests branch June 17, 2023 13:41
@AlexWaygood
Copy link
Member Author

Merge this -- the bug probably isn't fixable? I think we'll have to document it. Writing up an issue now :/

#245

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants