diff --git a/mypy/semanal.py b/mypy/semanal.py index 0c38793d013fa..087671e6d973c 100644 --- a/mypy/semanal.py +++ b/mypy/semanal.py @@ -2041,12 +2041,10 @@ def visit_import_all(self, i: ImportAll) -> None: if self.process_import_over_existing_name( name, existing_symbol, node, i): continue - # In stub files, `from x import *` always reexports the symbols. - # In regular files, only if implicit reexports are enabled. - module_public = self.is_stub_file or self.options.implicit_reexport + # `from x import *` always reexports symbols self.add_imported_symbol(name, node, i, - module_public=module_public, - module_hidden=not module_public) + module_public=True, + module_hidden=False) else: # Don't add any dummy symbols for 'from x import *' if 'x' is unknown. diff --git a/test-data/unit/check-flags.test b/test-data/unit/check-flags.test index 02f6b034c512b..8f72a82b0760d 100644 --- a/test-data/unit/check-flags.test +++ b/test-data/unit/check-flags.test @@ -1562,17 +1562,7 @@ __all__ = ('b',) [out] main:2: error: Module "other_module_2" does not explicitly export attribute "a"; implicit reexport disabled -[case testNoImplicitReexportStarConsideredImplicit] -# flags: --no-implicit-reexport -from other_module_2 import a -[file other_module_1.py] -a = 5 -[file other_module_2.py] -from other_module_1 import * -[out] -main:2: error: Module "other_module_2" does not explicitly export attribute "a"; implicit reexport disabled - -[case testNoImplicitReexportStarCanBeReexportedWithAll] +[case testNoImplicitReexportStarConsideredExplicit] # flags: --no-implicit-reexport from other_module_2 import a from other_module_2 import b @@ -1583,8 +1573,6 @@ b = 6 from other_module_1 import * __all__ = ('b',) [builtins fixtures/tuple.pyi] -[out] -main:2: error: Module "other_module_2" does not explicitly export attribute "a"; implicit reexport disabled [case testNoImplicitReexportGetAttr] # flags: --no-implicit-reexport --python-version 3.7