summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/ext/mypy/plugin.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2021-12-22 16:21:33 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2021-12-22 16:22:49 -0500
commitaded8b11d9eccbd1f2b645a94338e34a3d234bc9 (patch)
tree13addfc556c77adc515e273d82d0fca04ea25c3f /lib/sqlalchemy/ext/mypy/plugin.py
parentab75ec2adb35b249ae6e700f965eb52c0340da69 (diff)
downloadsqlalchemy-aded8b11d9eccbd1f2b645a94338e34a3d234bc9.tar.gz
use fully qualified, locatable names for all use of api.named_type()
Fixed mypy regression where the release of mypy 0.930 added additional internal checks to the format of "named types", requiring that they be fully qualified and locatable. This broke the mypy plugin for SQLAlchemy, raising an assertion error, as there was use of symbols such as ``__builtins__`` and other un-locatable or unqualified names that previously had not raised any assertions. Fixes: #7496 Change-Id: I037680606a1d51158ef6503508ec76c5d5adc946
Diffstat (limited to 'lib/sqlalchemy/ext/mypy/plugin.py')
-rw-r--r--lib/sqlalchemy/ext/mypy/plugin.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/sqlalchemy/ext/mypy/plugin.py b/lib/sqlalchemy/ext/mypy/plugin.py
index 356b0d948..8687012a1 100644
--- a/lib/sqlalchemy/ext/mypy/plugin.py
+++ b/lib/sqlalchemy/ext/mypy/plugin.py
@@ -142,7 +142,7 @@ def _dynamic_class_hook(ctx: DynamicClassDefContext) -> None:
)
info.bases = [Instance(cls_arg.node, [])]
else:
- obj = ctx.api.named_type("__builtins__.object")
+ obj = ctx.api.named_type(names.NAMED_TYPE_BUILTINS_OBJECT)
info.bases = [obj]
@@ -152,7 +152,7 @@ def _dynamic_class_hook(ctx: DynamicClassDefContext) -> None:
util.fail(
ctx.api, "Not able to calculate MRO for declarative base", ctx.call
)
- obj = ctx.api.named_type("__builtins__.object")
+ obj = ctx.api.named_type(names.NAMED_TYPE_BUILTINS_OBJECT)
info.bases = [obj]
info.fallback_to_any = True