diff --git a/mypy/semanal.py b/mypy/semanal.py index e55fada5689c..21741f90a528 100644 --- a/mypy/semanal.py +++ b/mypy/semanal.py @@ -1933,7 +1933,9 @@ def report_missing_module_attribute( if self.is_incomplete_namespace(import_id): # We don't know whether the name will be there, since the namespace # is incomplete. Defer the current target. - self.mark_incomplete(imported_id, context) + self.mark_incomplete( + imported_id, context, module_public=module_public, module_hidden=module_hidden + ) return message = 'Module "{}" has no attribute "{}"'.format(import_id, source_id) # Suggest alternatives, if any match is found. diff --git a/test-data/unit/check-incremental.test b/test-data/unit/check-incremental.test index 342850ab24d0..1d2262ab303d 100644 --- a/test-data/unit/check-incremental.test +++ b/test-data/unit/check-incremental.test @@ -5585,3 +5585,28 @@ bar.x + 0 x = 0 [rechecked] [stale] + +[case testExplicitReexportImportCycleWildcard] +# flags: --no-implicit-reexport +import pkg.a +[file pkg/__init__.pyi] + +[file pkg/a.pyi] +MYPY = False +if MYPY: + from pkg.b import B + +[file pkg/b.pyi] +import pkg.a +MYPY = False +if MYPY: + from pkg.c import C +class B: + pass + +[file pkg/c.pyi] +from pkg.a import * +class C: + pass +[rechecked] +[stale]