[issue18812] PyImport_Import redundant calls to find module

2013-08-26 Thread Rob Bairos
Rob Bairos added the comment: Okay, thanks for looking into it. Cheers -- ___ Python tracker ___ ___ Python-bugs-list mailing list Uns

[issue18812] PyImport_Import redundant calls to find module

2013-08-23 Thread Brett Cannon
Brett Cannon added the comment: If I were to change this code in any way it would be to stop passing in a dummy value for fromlist, not stop pulling from sys.modules. The official idiom for directly calling __import__() is:: __import__(module_name) return sys.modules[module_name] It just

[issue18812] PyImport_Import redundant calls to find module

2013-08-23 Thread Rob Bairos
Rob Bairos added the comment: However, if it fails __import()__ it doesn't get to the sys.modules[] call anyways. The only case affected by this are: PASS the __import()__ call, then FAIL the sys.modules[] lookup afterwards. Why will that effect anything currently out there? As it stan

[issue18812] PyImport_Import redundant calls to find module

2013-08-23 Thread Brett Cannon
Brett Cannon added the comment: Because that is how it has always been: http://hg.python.org/cpython/file/b9b521efeba3/Python/import.c#l3164 . It could be changed but someone out there is relying on those semantics and it's a minor thing to leave in so I don't want to mess with it. --

[issue18812] PyImport_Import redundant calls to find module

2013-08-22 Thread Eric Snow
Eric Snow added the comment: My guess is that, in part, it's left-over code from before the switch to importlib. However, it relies on builtins.__import__(), which isn't guaranteed to work correctly, hence one last sync with sys.modules. I'm not convinced that justifies not simply returning

[issue18812] PyImport_Import redundant calls to find module

2013-08-22 Thread Rob Bairos
Changes by Rob Bairos : -- type: -> behavior ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pytho

[issue18812] PyImport_Import redundant calls to find module

2013-08-22 Thread Rob Bairos
New submission from Rob Bairos: Why does PyImport_Import (import.c) call __import__ then immediately discard the result, and then look for the module again in the module dictionary? It will return the same value in both cases no? Ive included the relevant portion of the code below. Its break