Skip to content

Commit b186f68

Browse files
Handle objects.Super in helpers.object_type() (#2177)
1 parent 5fa9089 commit b186f68

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

ChangeLog

+3
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ What's New in astroid 2.15.5?
152152
=============================
153153
Release date: TBA
154154

155+
* Handle ``objects.Super`` in ``helpers.object_type()``.
156+
157+
Refs pylint-dev/pylint#8554
155158

156159

157160
What's New in astroid 2.15.4?

astroid/helpers.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
from collections.abc import Generator
1010

11-
from astroid import bases, manager, nodes, raw_building, util
11+
from astroid import bases, manager, nodes, objects, raw_building, util
1212
from astroid.context import CallContext, InferenceContext
1313
from astroid.exceptions import (
1414
AstroidTypeError,
@@ -69,7 +69,7 @@ def _object_type(
6969
raise InferenceError
7070
elif isinstance(inferred, util.UninferableBase):
7171
yield inferred
72-
elif isinstance(inferred, (bases.Proxy, nodes.Slice)):
72+
elif isinstance(inferred, (bases.Proxy, nodes.Slice, objects.Super)):
7373
yield inferred._proxied
7474
else: # pragma: no cover
7575
raise AssertionError(f"We don't handle {type(inferred)} currently")

tests/test_helpers.py

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ def test_object_type(self) -> None:
4242
("type", self._extract("type")),
4343
("object", self._extract("type")),
4444
("object()", self._extract("object")),
45+
("super()", self._extract("super")),
4546
("lambda: None", self._build_custom_builtin("function")),
4647
("len", self._build_custom_builtin("builtin_function_or_method")),
4748
("None", self._build_custom_builtin("NoneType")),

0 commit comments

Comments
 (0)