Skip to content

Fix incremental issue with namespace packages (option 2) #18908

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions mypy/semanal.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,9 +404,6 @@ class SemanticAnalyzer(
cur_mod_id = "" # Current module id (or None) (phase 2)
_is_stub_file = False # Are we analyzing a stub file?
_is_typeshed_stub_file = False # Are we analyzing a typeshed stub file?
imports: set[str] # Imported modules (during phase 2 analysis)
# Note: some imports (and therefore dependencies) might
# not be found in phase 1, for example due to * imports.
errors: Errors # Keeps track of generated errors
plugin: Plugin # Mypy plugin for special casing of library features
statement: Statement | None = None # Statement/definition being analyzed
Expand Down Expand Up @@ -445,7 +442,6 @@ def __init__(
self.saved_locals: dict[
FuncItem | GeneratorExpr | DictionaryComprehension, SymbolTable
] = {}
self.imports = set()
self._type = None
self.type_stack = []
# Are the namespaces of classes being processed complete?
Expand Down Expand Up @@ -3114,9 +3110,6 @@ def visit_import_all(self, i: ImportAll) -> None:
# if '__all__' exists, all nodes not included have had module_public set to
# False, and we can skip checking '_' because it's been explicitly included.
if node.module_public and (not name.startswith("_") or "__all__" in m.names):
if isinstance(node.node, MypyFile):
# Star import of submodule from a package, add it as a dependency.
self.imports.add(node.node.fullname)
# `from x import *` always reexports symbols
self.add_imported_symbol(
name, node, context=i, module_public=True, module_hidden=False
Expand Down
5 changes: 0 additions & 5 deletions mypy/semanal_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,11 +405,6 @@ def semantic_analyze_target(
)
if isinstance(node, Decorator):
infer_decorator_signature_if_simple(node, analyzer)
for dep in analyzer.imports:
state.add_dependency(dep)
priority = mypy.build.PRI_LOW
if priority <= state.priorities.get(dep, priority):
state.priorities[dep] = priority

# Clear out some stale data to avoid memory leaks and astmerge
# validity check confusion
Expand Down