Skip to content

Ignore more exceptions in stubtest #11946

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions mypy/stubtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,11 +269,14 @@ def verify_typeinfo(
mangled_entry = "_{}{}".format(stub.name, entry)
stub_to_verify = next((t.names[entry].node for t in stub.mro if entry in t.names), MISSING)
assert stub_to_verify is not None
yield from verify(
stub_to_verify,
getattr(runtime, mangled_entry, MISSING),
object_path + [entry],
)
try:
runtime_attr = getattr(runtime, mangled_entry, MISSING)
except Exception:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to log it somehow?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure there's a good framework for that. Perhaps we can add a constant similar to MISSING, or fall back to a runtime value of Any if a non-AttriibuteError exception is thrown.

# Catch all exceptions in case the runtime raises an unexpected exception
# from __getattr__ or similar.
pass
else:
yield from verify(stub_to_verify, runtime_attr, object_path + [entry])


def _verify_static_class_methods(
Expand Down