diff --git a/ChangeLog b/ChangeLog index d05a19c909..4135eb93f4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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. @@ -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. diff --git a/astroid/interpreter/_import/util.py b/astroid/interpreter/_import/util.py index 06afd19267..a8af9ec6ae 100644 --- a/astroid/interpreter/_import/util.py +++ b/astroid/interpreter/_import/util.py @@ -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