summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Walls <jacobtylerwalls@gmail.com>2023-05-14 12:48:27 -0400
committerGitHub <noreply@github.com>2023-05-14 18:48:27 +0200
commitb186f683da0896d2fbed0f2aae3497b29ca93266 (patch)
tree5ff79d117656067a58a5ec1d0b2c82f502b47790
parent5fa9089f1af6da65640e5ff81ae79207d039b4bd (diff)
downloadastroid-git-b186f683da0896d2fbed0f2aae3497b29ca93266.tar.gz
Handle ``objects.Super`` in `helpers.object_type()` (#2177)
-rw-r--r--ChangeLog3
-rw-r--r--astroid/helpers.py4
-rw-r--r--tests/test_helpers.py1
3 files changed, 6 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 27e4d049..b5e97c31 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -152,6 +152,9 @@ What's New in astroid 2.15.5?
=============================
Release date: TBA
+* Handle ``objects.Super`` in ``helpers.object_type()``.
+
+ Refs pylint-dev/pylint#8554
What's New in astroid 2.15.4?
diff --git a/astroid/helpers.py b/astroid/helpers.py
index 3c5d8e5f..40bbf7e0 100644
--- a/astroid/helpers.py
+++ b/astroid/helpers.py
@@ -8,7 +8,7 @@ from __future__ import annotations
from collections.abc import Generator
-from astroid import bases, manager, nodes, raw_building, util
+from astroid import bases, manager, nodes, objects, raw_building, util
from astroid.context import CallContext, InferenceContext
from astroid.exceptions import (
AstroidTypeError,
@@ -69,7 +69,7 @@ def _object_type(
raise InferenceError
elif isinstance(inferred, util.UninferableBase):
yield inferred
- elif isinstance(inferred, (bases.Proxy, nodes.Slice)):
+ elif isinstance(inferred, (bases.Proxy, nodes.Slice, objects.Super)):
yield inferred._proxied
else: # pragma: no cover
raise AssertionError(f"We don't handle {type(inferred)} currently")
diff --git a/tests/test_helpers.py b/tests/test_helpers.py
index 5fdadc23..aaf45c74 100644
--- a/tests/test_helpers.py
+++ b/tests/test_helpers.py
@@ -42,6 +42,7 @@ class TestHelpers(unittest.TestCase):
("type", self._extract("type")),
("object", self._extract("type")),
("object()", self._extract("object")),
+ ("super()", self._extract("super")),
("lambda: None", self._build_custom_builtin("function")),
("len", self._build_custom_builtin("builtin_function_or_method")),
("None", self._build_custom_builtin("NoneType")),