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

Fix protocol’s __init__ behaviour to be same like in python >= 3.8 #780

Merged
merged 1 commit into from
Apr 10, 2021

Conversation

dkraczkowski
Copy link
Contributor

@dkraczkowski dkraczkowski commented Jan 21, 2021

Hello everyone, I am author of a dependency injection container for python: https://pypi.org/project/kink/. Lately we run into some issues with older versions of python were we do use typing_extensions as a pollyfill for missing functionalities.

In python >= 3.8 _no_init function which is responsible for disabling Protocol's initialisation is defined in the global scope of a module, which allows us to do checks like here: https://github.com/kodemore/kink/blob/master/kink/inject.py#L75. Sadly in typing_extensions this function is defined as a local function so when doing the check memory address does not match and comparison fails. This is inconsistent with python >= 3.8 implementation and this PR fixes this inconsistency.

I have also prepared test to cover the use-case.

@the-knights-who-say-ni
Copy link

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA).

Recognized GitHub username

We couldn't find a bugs.python.org (b.p.o) account corresponding to the following GitHub usernames:

@dkraczkowski

This might be simply due to a missing "GitHub Name" entry in one's b.p.o account settings. This is necessary for legal reasons before we can look at this contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

You can check yourself to see if the CLA has been received.

Thanks again for the contribution, we look forward to reviewing it!

@JelleZijlstra
Copy link
Member

Thanks for your contribution!

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

Successfully merging this pull request may close these issues.

3 participants