Brett Cannon <br...@python.org> added the comment:

OK, I figured this one out. Someone is using importlib.import_module() which 
uses importlib itself to do the import and not builtins.__import__. That has 
the side-effect of importlib replacing all None entries in 
sys.path_importer_cache with the finder that importlib creates (an optimization 
so that importlib doesn't have to re-construct the finder constantly and to 
slowly drop the use of None).

There are three ways to fix this. One is to not insert the new finders into 
sys.path_importer_cache. Two is to have importlib.import_module use __import__. 
Three is to leave it as-is (and to obviously fix the problem importlib is 
triggering).

>From a selfish perspective I like option 3 since it helps weed out bugs in 
>importlib, but that is unfair to __import__ for testing plus it slows down the 
>test suite overall from importlib being slower. And I won't do option 1 since 
>that would make importlib perform even worse. So I guess that leaves option 2 
>unless people are actually okay with option 3.

----------

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

Reply via email to