8000 bpo-44975: [typing] Support issubclass for ClassVar data members by Fidget-Spinner · Pull Request #27883 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-44975: [typing] Support issubclass for ClassVar data members #27883

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
Prev Previous commit
Next Next commit
Use identity check instead of equality
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
  • Loading branch information
Fidget-Spinner and ambv authored Aug 26, 2021
commit c8423705307ee8a7242850afc7fee698329ddf9a
2 changes: 1 addition & 1 deletion Lib/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1405,7 +1405,7 @@ def _is_callable_or_classvar_members_only(cls):
if callable(attr):
continue
annotation = annotations.get(attr_name)
if getattr(annotation, '__name__', None) == 'ClassVar':
if getattr(annotation, '__origin__', None) is ClassVar:
continue
# String annotations (forward references).
if isinstance(annotation, str) and annotation.startswith(_classvar_prefixes):
Expand Down
0