Skip to content

Commit 2ff7c0d

Browse files
authored
[release 1.5] stubtest: Fix __mypy-replace false positives (#15689) (#15751)
1 parent 373b73a commit 2ff7c0d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

mypy/stubtest.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,11 @@ def verify_typeinfo(
496496
)
497497

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

0 commit comments

Comments
 (0)