Skip to content

Commit

Permalink
add PlaceholderNode when deferring manager class hook
Browse files Browse the repository at this point in the history
  • Loading branch information
asottile committed Jun 21, 2024
1 parent c693e2a commit e88fab8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mypy_django_plugin/transformers/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
MemberExpr,
Node,
OverloadedFuncDef,
PlaceholderNode,
RefExpr,
StrExpr,
SymbolTableNode,
Expand Down Expand Up @@ -317,6 +318,9 @@ def create_new_manager_class_from_from_queryset_method(ctx: DynamicClassDefConte
new_manager_info = create_manager_info_from_from_queryset_call(semanal_api, ctx.call, ctx.name)
if new_manager_info is None:
if not ctx.api.final_iteration:
# XXX: hack for python/mypy#17402
ph = PlaceholderNode(ctx.api.qualified_name(ctx.name), ctx.call, ctx.call.line, becomes_typeinfo=True)
ctx.api.add_symbol_table_node(ctx.name, SymbolTableNode(GDEF, ph))
ctx.api.defer()
return

Expand Down

0 comments on commit e88fab8

Please sign in to comment.