From 573ac89692b43eb77e2d49b571740d217fedbd79 Mon Sep 17 00:00:00 2001 From: hauntsaninja <> Date: Sun, 24 May 2020 19:09:46 -0700 Subject: [PATCH] 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. --- mypy/stubtest.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mypy/stubtest.py b/mypy/stubtest.py index 245148c9eab3..3dc0468868bd 100644 --- a/mypy/stubtest.py +++ b/mypy/stubtest.py @@ -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