Skip to content

ISSUE-7806: Add missing attributes to FakeInfo #7828

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

Closed
wants to merge 3 commits into from
Closed
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
8 changes: 6 additions & 2 deletions mypy/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2619,12 +2619,16 @@ class FakeInfo(TypeInfo):
# TypeInfo defines a __bool__ method that returns False for FakeInfo
# so that it can be conveniently tested against in the same way that it
# would be if things were properly optional.

# Fake fullname so `mypy.checkmember` can process this info.
_fullname = 'FakeInfo'

def __init__(self, msg: str) -> None:
self.msg = msg

def __getattribute__(self, attr: str) -> None:
# Handle __class__ so that isinstance still works...
if attr == '__class__':
# Handle __class__, fullname, type_vars so that isinstance still works...
if attr in ('__class__', 'fullname', '_fullname', 'type_vars'):
return object.__getattribute__(self, attr)
raise AssertionError(object.__getattribute__(self, 'msg'))

Expand Down