Skip to content

Commit 2b33bdb

Browse files
committed
reset known modules cache
1 parent 1f601c1 commit 2b33bdb

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

mypy/build.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@
150150
from mypy.renaming import LimitedVariableRenameVisitor, VariableRenameVisitor
151151
from mypy.stats import dump_type_stats
152152
from mypy.stubinfo import is_module_from_legacy_bundled_package, stub_distribution_name
153-
from mypy.known_modules import get_known_modules
153+
from mypy.known_modules import get_known_modules, reset_known_modules_cache
154154
from mypy.messages import best_matches, pretty_seq
155155
from mypy.types import Type, instance_cache
156156
from mypy.typestate import reset_global_state, type_state
@@ -337,6 +337,7 @@ def build(
337337

338338
# This is mostly for the benefit of tests that use builtins fixtures.
339339
instance_cache.reset()
340+
reset_known_modules_cache()
340341

341342
def default_flush_errors(
342343
filename: str | None, new_messages: list[str], is_serious: bool

mypy/known_modules.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@
152152

153153
_known_modules_cache: frozenset[str] | None = None
154154

155+
def reset_known_modules_cache() -> None:
156+
global _known_modules_cache
157+
_known_modules_cache = None
158+
155159

156160
def get_stdlib_modules(
157161
stdlib_versions: StdlibVersions,

0 commit comments

Comments
 (0)