Skip to content

Handle objects.Super in helpers.object_type() #2177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,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