Skip to content

Commit 573ac89

Browse files
author
hauntsaninja
committed
stubtest: fix false negatives
If the stub doesn't list dunder methods, we wouldn't check them earlier. There are a lot of false negatives due to this.
1 parent 58e596a commit 573ac89

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

mypy/stubtest.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,11 @@ def verify_typeinfo(
237237
return
238238

239239
to_check = set(stub.names)
240+
dunders_to_check = ("__init__", "__new__", "__call__")
240241
# cast to workaround mypyc complaints
241-
to_check.update(m for m in cast(Any, vars)(runtime) if not m.startswith("_"))
242+
to_check.update(
243+
m for m in cast(Any, vars)(runtime) if m in dunders_to_check or not m.startswith("_")
244+
)
242245

243246
for entry in sorted(to_check):
244247
mangled_entry = entry

0 commit comments

Comments
 (0)