From 2e3778e08d2c61f0bf514264a1a1223618466822 Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Sat, 10 Jul 2021 23:10:20 +0200 Subject: [PATCH] [#4692] Add a regression test for inference crash --- ChangeLog | 5 +++++ tests/functional/i/inference_crash_4692.py | 7 +++++++ tests/functional/i/inference_crash_4692.txt | 1 + 3 files changed, 13 insertions(+) create mode 100644 tests/functional/i/inference_crash_4692.py create mode 100644 tests/functional/i/inference_crash_4692.txt diff --git a/ChangeLog b/ChangeLog index b8fb495ea6..df8bdc7d35 100644 --- a/ChangeLog +++ b/ChangeLog @@ -26,6 +26,11 @@ Release date: TBA Closes #4732 +* Fix a crash when a AttributeInferenceError was not handled properly when + failing to infer the real name of an import in astroid. + + Closes #4692 + What's New in Pylint 2.9.4? =========================== diff --git a/tests/functional/i/inference_crash_4692.py b/tests/functional/i/inference_crash_4692.py new file mode 100644 index 0000000000..043c6bb1c7 --- /dev/null +++ b/tests/functional/i/inference_crash_4692.py @@ -0,0 +1,7 @@ +"""Regression test for https://github.com/PyCQA/pylint/issues/4692.""" + +import click # [import-error] + + +for name, item in click.__dict__.items(): + _ = isinstance(item, click.Command) and item != 'foo' diff --git a/tests/functional/i/inference_crash_4692.txt b/tests/functional/i/inference_crash_4692.txt new file mode 100644 index 0000000000..1ba264e74e --- /dev/null +++ b/tests/functional/i/inference_crash_4692.txt @@ -0,0 +1 @@ +import-error:3:0::Unable to import 'click':HIGH