From 16c88b254454cc20cc1a92a23a8d290b8155bbda Mon Sep 17 00:00:00 2001 From: Jaen Saul Date: Fri, 19 Nov 2021 22:12:44 +0200 Subject: [PATCH] fix(mypy): Placeholder vars should have fullname set. Otherwise the dmypy daemon will crash on an incremental re-run. Fixes: #7347 Closes: #7348 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/7348 Pull-request-sha: 79eefa3417e09a8f9defaeafdb9f76d323385238 Change-Id: Id2133e837ee5dcf43461af51458e296353bdad6c (cherry picked from commit 7c170ade108b907c4ea6c7a73cc606afd1838885) --- doc/build/changelog/unreleased_14/7347.rst | 6 ++++++ lib/sqlalchemy/ext/mypy/apply.py | 1 + 2 files changed, 7 insertions(+) create mode 100644 doc/build/changelog/unreleased_14/7347.rst diff --git a/doc/build/changelog/unreleased_14/7347.rst b/doc/build/changelog/unreleased_14/7347.rst new file mode 100644 index 0000000000..f259112fd9 --- /dev/null +++ b/doc/build/changelog/unreleased_14/7347.rst @@ -0,0 +1,6 @@ +.. change:: + :tags: bug, mypy + :tickets: 7321 + + Fixed Mypy crash when running id daemon mode caused by a + missing attribute on an internal mypy ``Var`` instance. diff --git a/lib/sqlalchemy/ext/mypy/apply.py b/lib/sqlalchemy/ext/mypy/apply.py index b3af0560c6..99be194cdc 100644 --- a/lib/sqlalchemy/ext/mypy/apply.py +++ b/lib/sqlalchemy/ext/mypy/apply.py @@ -293,6 +293,7 @@ def _apply_placeholder_attr_to_class( else: type_ = AnyType(TypeOfAny.special_form) var = Var(attrname) + var._fullname = cls.fullname + "." + attrname var.info = cls.info var.type = type_ cls.info.names[attrname] = SymbolTableNode(MDEF, var) -- 2.47.2