[Python-Dev] Peculiar import code in pickle.py (original) (raw)

Alexander Belopolsky alexander.belopolsky at gmail.com
Tue Jul 13 23:20:42 CEST 2010


On Tue, Jul 13, 2010 at 4:52 PM, Brett Cannon <brett at python.org> wrote: ..

Pulling from sys.modules is the correct way to do this. There are subtle issues when using a bunk fromlist argument (empty modules, double initialization, etc.). If one does not use importlib.importmodule -- written specifically to prevent people from doing the nasty hack with the fromlist -- then you should use the sys.modules approach, period. If import.c is not doing this then it should get fixed. You can assign me the issue if you want.

Please see http://bugs.python.org/issue9252 .



More information about the Python-Dev mailing list