[issue17636] Modify IMPORT_FROM to fallback on sys.modules

Phillip J. Eby report at bugs.python.org
Sun Apr 14 16:34:58 CEST 2013


Phillip J. Eby added the comment:

On Sun, Apr 14, 2013 at 3:51 AM, Nick Coghlan <report at bugs.python.org> wrote:
> Your analysis is one of the pieces that was missing,

Unfortunately, I just noticed it's actually incorrect in a pretty
important part  In my original example, I said, "because of the
circularity, this will *also* happen if you import 'a' first."  This
statement is actually false.  Importing 'a' first in that example will
result in a.util == b.util:util, not a.util=b.util.  I made the
mistake because I was for some reason thinking that 'a' was going to
execute its import while being imported from b.util, and in that
scenario it will not.

That means there *is* an ordering dependency, and an ambiguity like
this one can lie dormant until long after you've introduced the
circularity.  :-(

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17636>
_______________________________________


More information about the Python-bugs-list mailing list