Skip to content

Don't make underscored attributes as enum members #8302

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

Merged
merged 4 commits into from
Jan 17, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix
  • Loading branch information
TH3CHARLie committed Jan 17, 2020
commit 279699e661bb5d99dfa590c35b6a086aedd2d963
2 changes: 1 addition & 1 deletion mypy/checkmember.py
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ def analyze_enum_class_attribute_access(itype: Instance,
mx.original_type, itype, name, mx.context, mx.module_symbol_table
)
# For other names surrendered by underscores, we don't make them Enum members
if name.startswith('__') and name.endswith("__"):
if name.startswith('__') and name.endswith("__") and name.replace('_', '') != '':
return None

enum_literal = LiteralType(name, fallback=itype)
Expand Down