Skip to content

Commit a3a03aa

Browse files
JelleZijlstratushar-deepsource
authored andcommitted
Ignore more exceptions in stubtest (python#11946)
See python/typeshed#6801.
1 parent 0b5a92d commit a3a03aa

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

mypy/stubtest.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -269,11 +269,14 @@ def verify_typeinfo(
269269
mangled_entry = "_{}{}".format(stub.name, entry)
270270
stub_to_verify = next((t.names[entry].node for t in stub.mro if entry in t.names), MISSING)
271271
assert stub_to_verify is not None
272-
yield from verify(
273-
stub_to_verify,
274-
getattr(runtime, mangled_entry, MISSING),
275-
object_path + [entry],
276-
)
272+
try:
273+
runtime_attr = getattr(runtime, mangled_entry, MISSING)
274+
except Exception:
275+
# Catch all exceptions in case the runtime raises an unexpected exception
276+
# from __getattr__ or similar.
277+
pass
278+
else:
279+
yield from verify(stub_to_verify, runtime_attr, object_path + [entry])
277280

278281

279282
def _verify_static_class_methods(

0 commit comments

Comments
 (0)