Skip to content

Commit

Permalink
Remove except block only needed for Python 3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtylerwalls committed Jul 1, 2023
1 parent 7864496 commit 1f475cb
Showing 1 changed file with 2 additions and 6 deletions.
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

0 comments on commit 1f475cb

Please sign in to comment.