Skip to content

Commit

Permalink
[release 1.5] stubtest: Fix __mypy-replace false positives (#15689) (
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexWaygood authored Jul 22, 2023
1 parent 373b73a commit 2ff7c0d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion mypy/stubtest.py
Original file line number Diff line number Diff line change
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 2ff7c0d

Please sign in to comment.