Skip to content
Merged
Changes from 1 commit
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
7 changes: 7 additions & 0 deletions mypy/stubtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,13 @@ def verify_typeinfo(
# Catch all exceptions in case the runtime raises an unexpected exception
# from __getattr__ or similar.
continue

# If it came from the metaclass, consider the runtime_attr to be MISSING
# for a more accurate message
if runtime_attr is not MISSING and type(runtime) != runtime:
Copy link
Member

Choose a reason for hiding this comment

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

Should != be is not?

And can you add a test that changes behavior with this patch?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think you're right. I'll have a test ready in a little bit.

if getattr(runtime_attr, "__objclass__", None) is type(runtime):
runtime_attr = MISSING

# Do not error for an object missing from the stub
# If the runtime object is a types.WrapperDescriptorType object
# and has a non-special dunder name.
Expand Down
Loading