Skip to content

Commit

Permalink
stubtest: Fix __mypy-replace false positives (python#15689)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexWaygood committed Jul 22, 2023
1 parent 373b73a commit e1599c4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion mypy/stubtest.py
Expand Up @@ -496,7 +496,11 @@ def verify_typeinfo(
)

# Check everything already defined on the stub class itself (i.e. not inherited)
to_check = set(stub.names)
#
# Filter out non-identifier names, as these are (hopefully always?) whacky/fictional things
# (like __mypy-replace or __mypy-post_init, etc.) that don't exist at runtime,
# and exist purely for internal mypy reasons
to_check = {name for name in stub.names if name.isidentifier()}
# Check all public things on the runtime class
to_check.update(
m for m in vars(runtime) if not is_probably_private(m) and m not in IGNORABLE_CLASS_DUNDERS
Expand Down

0 comments on commit e1599c4

Please sign in to comment.