8000 Support typing.TYPE_CHECKING · Issue #2165 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content

Support typing.TYPE_CHECKING #2165

8000
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

Closed
gvanrossum opened this issue Sep 21, 2016 · 3 comments
Closed

Support typing.TYPE_CHECKING #2165

gvanrossum opened this issue Sep 21, 2016 · 3 comments

Comments

@gvanrossum
Copy link
Member
gvanrossum commented Sep 21, 2016

This ought to replace MYPY as a special variable.

See https://www.python.org/dev/peps/pep-0484/#runtime-or-type-checking

@gvanrossum gvanrossum changed the title Support typing.TYPE_CHECKER Support typing.TYPE_CHECKING Sep 21, 2016
@elazarg
Copy link
Contributor
elazarg commented Sep 21, 2016

Anything more than adding to semanal.py

        elif name == 'MYPY':
            result = ALWAYS_TRUE
+       elif name == 'TYPE_CHECKING':
+           result = ALWAYS_TRUE
    if negated:

?

(I don't think it should be looking for typing.TYPE_CHECKING. It's more flexible without it)

8000
@gvanrossum gvanrossum self-assigned this Sep 21, 2016
@gvanrossum
Copy link
Member Author

Agreed, I have a patch ready.

gvanrossum pushed a commit that referenced this issue Sep 21, 2016
Fixes #2165.

This is not completely correct (it'll trigger on *any* variable named
TYPE_CHECKING) but I think that's acceptable.  We should be able to
phase out MYPY once this is in the next release.
@gvanrossum
Copy link
Member Author

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

No branches or pull requests

2 participants
0