[issue37444] Differing exception between builtins and importlib when importing beyond top-level package

Miro Hrončok report at bugs.python.org
Tue Jan 21 07:01:13 EST 2020


Miro Hrončok <miro at hroncok.cz> added the comment:

While raising ImportError certainly makes much more sense in this case, this change is backwards incompatible and there was no DeprecationWarning. I don't consider that fair.

As a certain compromise, we could maybe raise a custom ImportError+ValueError offspring (e.g. BeyondToplevelImportError)?

If feeling fancy, we could rise a DeprecationWarning when issublcass(BeyondToplevelImportError, ValueError) is used?

----------
nosy: +hroncok

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37444>
_______________________________________


More information about the Python-bugs-list mailing list