Skip to content

Commit

Permalink
stubtest: fix false negatives
Browse files Browse the repository at this point in the history
If the stub doesn't list dunder methods, we wouldn't check them earlier.
There are a lot of false negatives due to this.
  • Loading branch information
hauntsaninja committed May 25, 2020
1 parent aa48c4b commit 4d30a84
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mypy/stubtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,11 @@ def verify_typeinfo(
return

to_check = set(stub.names)
dunders_to_check = ("__init__", "__new__", "__call__")
# cast to workaround mypyc complaints
to_check.update(m for m in cast(Any, vars)(runtime) if not m.startswith("_"))
to_check.update(
m for m in cast(Any, vars)(runtime) if m in dunders_to_check or not m.startswith("_")
)

for entry in sorted(to_check):
mangled_entry = entry
Expand Down

0 comments on commit 4d30a84

Please sign in to comment.