Skip to content

Commit 80f8932

Browse files
authored
use builtin_type if it exists, otherwise named_type (#234)
1 parent bcab904 commit 80f8932

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

sqlmypy.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,9 @@ def decl_info_hook(ctx: DynamicClassDefContext) -> None:
200200

201201
info = TypeInfo(SymbolTable(), class_def, ctx.api.cur_mod_id)
202202
class_def.info = info
203-
obj = ctx.api.builtin_type('builtins.object')
203+
# use builtin_type if it exists, otherwise named_type
204+
# mypy .930 deprecated builtin_type, but it was added back in in .931
205+
obj = ctx.api.builtin_type('builtins.object') if hasattr(ctx.api, "builtin_type") else ctx.api.named_type('builtins.object')
204206
info.bases = cls_bases or [obj]
205207
try:
206208
calculate_mro(info)

0 commit comments

Comments
 (0)