Skip to content

Commit

Permalink
Handle objects.Super in helpers.object_type() (#2177)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtylerwalls authored May 14, 2023
1 parent 5fa9089 commit b186f68
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
4 changes: 2 additions & 2 deletions astroid/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

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,
Expand Down Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions tests/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def test_object_type(self) -> None:
("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")),
Expand Down

0 comments on commit b186f68

Please sign in to comment.