Skip to content

Commit a389ef7

Browse files
authored
Use a tuple for processed parameter to facilitate future caching (pylint-dev#2529)
1 parent 16990fc commit a389ef7

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

astroid/interpreter/_import/spec.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def __init__(self, path: Sequence[str] | None = None) -> None:
9191
def find_module(
9292
modname: str,
9393
module_parts: tuple[str],
94-
processed: list[str],
94+
processed: tuple[str],
9595
submodule_path: Sequence[str] | None,
9696
) -> ModuleSpec | None:
9797
"""Find the given module.
@@ -130,7 +130,7 @@ class ImportlibFinder(Finder):
130130
def find_module(
131131
modname: str,
132132
module_parts: tuple[str],
133-
processed: list[str],
133+
processed: tuple[str],
134134
submodule_path: Sequence[str] | None,
135135
) -> ModuleSpec | None:
136136
if submodule_path is not None:
@@ -225,7 +225,7 @@ class ExplicitNamespacePackageFinder(ImportlibFinder):
225225
def find_module(
226226
modname: str,
227227
module_parts: tuple[str],
228-
processed: list[str],
228+
processed: tuple[str],
229229
submodule_path: Sequence[str] | None,
230230
) -> ModuleSpec | None:
231231
if processed:
@@ -265,7 +265,7 @@ def __init__(self, path: Sequence[str]) -> None:
265265
def find_module(
266266
modname: str,
267267
module_parts: tuple[str],
268-
processed: list[str],
268+
processed: tuple[str],
269269
submodule_path: Sequence[str] | None,
270270
) -> ModuleSpec | None:
271271
try:
@@ -289,7 +289,7 @@ class PathSpecFinder(Finder):
289289
def find_module(
290290
modname: str,
291291
module_parts: tuple[str],
292-
processed: list[str],
292+
processed: tuple[str],
293293
submodule_path: Sequence[str] | None,
294294
) -> ModuleSpec | None:
295295
spec = importlib.machinery.PathFinder.find_spec(modname, path=submodule_path)
@@ -373,7 +373,7 @@ def _find_spec_with_path(
373373
search_path: Sequence[str],
374374
modname: str,
375375
module_parts: tuple[str],
376-
processed: list[str],
376+
processed: tuple[str],
377377
submodule_path: Sequence[str] | None,
378378
) -> tuple[Finder | _MetaPathFinder, ModuleSpec]:
379379
for finder in _SPEC_FINDERS:
@@ -457,7 +457,7 @@ def _find_spec(module_path: tuple, path: tuple) -> ModuleSpec:
457457
while modpath:
458458
modname = modpath.pop(0)
459459
finder, spec = _find_spec_with_path(
460-
_path, modname, module_parts, processed, submodule_path or path
460+
_path, modname, module_parts, tuple(processed), submodule_path or path
461461
)
462462
processed.append(modname)
463463
if modpath:

0 commit comments

Comments
 (0)