Skip to content

Commit cb9dd7d

Browse files
authored
[mypyc] fix relative imports in __init__.py (#17979)
Fixes mypyc/mypyc#1070 Missed in #10543
1 parent b16c192 commit cb9dd7d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

mypyc/irbuild/statement.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,10 +347,10 @@ def transform_import_from(builder: IRBuilder, node: ImportFrom) -> None:
347347
return
348348

349349
module_state = builder.graph[builder.module_name]
350-
if module_state.ancestors is not None and module_state.ancestors:
351-
module_package = module_state.ancestors[0]
352-
elif builder.module_path.endswith("__init__.py"):
350+
if builder.module_path.endswith("__init__.py"):
353351
module_package = builder.module_name
352+
elif module_state.ancestors is not None and module_state.ancestors:
353+
module_package = module_state.ancestors[0]
354354
else:
355355
module_package = ""
356356

0 commit comments

Comments
 (0)