Skip to content
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

Remove except block only needed for Python 3.7 #2230

Merged
merged 2 commits into from
Jul 1, 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
4 changes: 2 additions & 2 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Release date: TBA
The breaking change allows us to better type and re-use the method within ``astroid``.

* Improved signature of the ``__init__`` and ``__postinit__`` methods of most nodes.
This includes makes ``lineno``, ``col_offset``, ``end_lineno``, ``end_col_offset`` and ``parent``
This includes making ``lineno``, ``col_offset``, ``end_lineno``, ``end_col_offset`` and ``parent``
required arguments for ``nodes.NodeNG`` and its subclasses.
For most other nodes, arguments of their ``__postinit__`` methods have been made required to better
represent how they would normally be constructed by the standard library ``ast`` module.
Expand Down Expand Up @@ -124,7 +124,7 @@ Release date: TBA
* Remove dependency on ``wrapt``.

* Remove dependency on ``lazy_object_proxy``. This includes the removal
of the assosicated ``lazy_import``, ``lazy_descriptor`` and ``proxy_alias`` utility functions.
of the associated ``lazy_import``, ``lazy_descriptor`` and ``proxy_alias`` utility functions.

* ``CallSite._unpack_args`` and ``CallSite._unpack_keywords`` now use ``safe_infer()`` for
better inference and fewer false positives.
Expand Down
8 changes: 2 additions & 6 deletions astroid/interpreter/_import/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,8 @@ def is_namespace(modname: str) -> bool:

# Repair last_submodule_search_locations
if last_submodule_search_locations:
# TODO: py38: remove except
try:
# pylint: disable=unsubscriptable-object
last_item = last_submodule_search_locations[-1]
except TypeError:
last_item = last_submodule_search_locations._recalculate()[-1]
# pylint: disable=unsubscriptable-object
last_item = last_submodule_search_locations[-1]
# e.g. for failure example above, add 'a/b' and keep going
# so that find_spec('a.b.c', path=['a', 'a/b']) succeeds
assumed_location = pathlib.Path(last_item) / component
Expand Down