Nick Coghlan added the comment:

The interpreter level problem covered by the current issue is that the 
difference between "import mypkg.module_a" and "from mypkg import module_a" is 
masking the fact that it is the original "import mypkg" that failed, and may 
still fail on the second and subsequent imports. That is, the user level code 
is at best dubious, but the interpreter is spitting out misleading error 
messages that obscure the real cause of the failure.

In the tests for #17636, we should ensure that all of the following 
consistently raise RuntimeError when the import fails (on both the initial and 
subsequent import attempts):

    import badpkg.goodmod
    raise RuntimeError("Always fails")

    from badpkg import goodmod
    raise RuntimeError("Always fails")

    from . import goodmod
    raise RuntimeError("Always fails")

Where that is the __init__.py code in the following layout:

    badpkg/
        __init__.py
        goodmod.py

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue17716>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to