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

Vendor typing._SpecialForm to fool typing._type_check #966

Merged
merged 4 commits into from Nov 29, 2021

Conversation

CharString
Copy link
Contributor

Adds a local copy of _SpecialForm in our namespace, so
typing._type_check won't raise TypeError. (#964)

@JelleZijlstra
Copy link
Member

This has severe merge conflicts because we just renamed src_py3 to src, could you rebase?

@CharString
Copy link
Contributor Author

:) I was looking into that.

Adds a local copy of _SpecialForm in our namespace, so
typing._type_check won't raise TypeError. (#964)
Chris Wesseling and others added 2 commits November 26, 2021 21:04
Co-authored-by: James Hilton-Balfe <50501825+Gobot1234@users.noreply.github.com>
@@ -2048,40 +2048,61 @@ def __eq__(self, other):

TypeGuard = _TypeGuard(_root=True)

if not hasattr(typing, "Self") and sys.version_info[:2] >= (3, 7):
# Vendored from cpython typing._SpecialFrom
Copy link
Member

Choose a reason for hiding this comment

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

It's a bit hard to follow the if chains here, but can't this just be together with the appropriate branch for 3.7-3.10 so we don't have to duplicate the conditions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should I refactor the uses of typing._SpecialForm to use this vendored verion too?

Copy link
Member

Choose a reason for hiding this comment

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

Let's change Self only for simplicity.

@JelleZijlstra JelleZijlstra merged commit 0c8e55f into python:master Nov 29, 2021
srittau pushed a commit to srittau/typing that referenced this pull request Dec 2, 2021
Adds a local copy of _SpecialForm in our namespace, so
typing._type_check won't raise TypeError. (#964)

Co-authored-by: James Hilton-Balfe <50501825+Gobot1234@users.noreply.github.com>
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.

None yet

4 participants