diff options
| author | Tushar Sadhwani <86737547+tushar-deepsource@users.noreply.github.com> | 2022-12-08 23:10:47 +0530 |
|---|---|---|
| committer | Daniƫl van Noord <13665637+DanielNoord@users.noreply.github.com> | 2022-12-27 00:23:42 +0100 |
| commit | 7ac19048d623ffbfbfb8808d5d59bcaca131d35e (patch) | |
| tree | 8048fce91808f8a6c42ce29a4811a7219364a400 | |
| parent | 2abee792e68edd37fd0d6092c702cc20a76dab6a (diff) | |
| download | astroid-git-7ac19048d623ffbfbfb8808d5d59bcaca131d35e.tar.gz | |
Fix crash if numpy doesn't have version (#1892)
* Fix crash if numpy doesn't have version
* Add changelog entry
* re run jobs
* Update ChangeLog
Co-authored-by: Mark Byrne <31762852+mbyrnepr2@users.noreply.github.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
Co-authored-by: Mark Byrne <31762852+mbyrnepr2@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
(cherry picked from commit 33b3100c3156b8846d62a8c655d63316e4f66223)
| -rw-r--r-- | ChangeLog | 3 | ||||
| -rw-r--r-- | astroid/brain/brain_numpy_utils.py | 2 |
2 files changed, 4 insertions, 1 deletions
@@ -17,6 +17,9 @@ Release date: TBA Closes PyCQA/pylint#5225 +* Fix crash if ``numpy`` module doesn't have ``version`` attribute. + + Refs PyCQA/pylint#7868 What's New in astroid 2.12.13? ============================== diff --git a/astroid/brain/brain_numpy_utils.py b/astroid/brain/brain_numpy_utils.py index 91881955..ae0331c8 100644 --- a/astroid/brain/brain_numpy_utils.py +++ b/astroid/brain/brain_numpy_utils.py @@ -30,7 +30,7 @@ def _get_numpy_version() -> tuple[str, str, str]: import numpy # pylint: disable=import-outside-toplevel return tuple(numpy.version.version.split(".")) - except ImportError: + except (ImportError, AttributeError): return ("0", "0", "0") |
