-
Notifications
You must be signed in to change notification settings - Fork 258
Vendor typing._SpecialForm to fool typing._type_check #966
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
This has severe merge conflicts because we just renamed src_py3 to src, could you rebase? |
:) I was looking into that. |
Adds a local copy of _SpecialForm in our namespace, so typing._type_check won't raise TypeError. (#964)
e07c767
to
936ebbe
Compare
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 |
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.
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?
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.
Should I refactor the uses of typing._SpecialForm to use this vendored verion too?
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.
Let's change Self only for simplicity.
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>
Adds a local copy of _SpecialForm in our namespace, so
typing._type_check won't raise TypeError. (#964)