From 4689b195d8539ef04fd0c30423037a5f4932a20f Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Thu, 2 Feb 2023 10:33:42 +0100 Subject: [PATCH] [crash] Fix crashes on python interpreter < 3.9 (#8163) Closes #8161 Co-authored-by: Marc Schmitzer --- doc/whatsnew/fragments/8161.bugfix | 3 +++ pylint/checkers/imports.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 doc/whatsnew/fragments/8161.bugfix diff --git a/doc/whatsnew/fragments/8161.bugfix b/doc/whatsnew/fragments/8161.bugfix new file mode 100644 index 0000000000..9570991809 --- /dev/null +++ b/doc/whatsnew/fragments/8161.bugfix @@ -0,0 +1,3 @@ +Fix a crash happening for python interpreter < 3.9 following a failed typing update. + +Closes #8161 diff --git a/pylint/checkers/imports.py b/pylint/checkers/imports.py index a66400441a..d29056b8c2 100644 --- a/pylint/checkers/imports.py +++ b/pylint/checkers/imports.py @@ -176,7 +176,7 @@ def _make_tree_defs(mod_files_list: ItemsView[str, set[str]]) -> _ImportTree: assert isinstance(node[0], dict) node = node[0].setdefault(prefix, ({}, [])) # type: ignore[arg-type,assignment] assert isinstance(node[1], list) - node[1] += files + node[1].extend(files) return tree_defs