[issue29787] Internal importlib frames visible when module imported by import_module throws exception

2017-03-14 Thread Brett Cannon
Brett Cannon added the comment: Yep, I agree it isn't as nice as syntactic import, but that can happen when you're not getting to use dedicated bytecode like syntactic import does. If you can come up with a patch that adds hardly any more C code -- say about 10 or 20 lines? -- I would consider

[issue29787] Internal importlib frames visible when module imported by import_module throws exception

2017-03-14 Thread Ulrich Petri
Ulrich Petri added the comment: Thanks for the fast response. However I disagree with the assertion that this is "working as expected". IMO the same arguments apply as in the original ticket (esp. Georg Brandls) http://bugs.python.org/issue15110#msg163258. It is unexpected, confusing (esp. to

[issue29787] Internal importlib frames visible when module imported by import_module throws exception

2017-03-13 Thread Brett Cannon
Brett Cannon added the comment: That's because the frame-stripping trick is done through import.c which importlib.import_module() doesn't pass through. So thanks for the report, Ulrich, but it is working as expected and we won't be changing import_module() to pass through the C code to keep th

[issue29787] Internal importlib frames visible when module imported by import_module throws exception

2017-03-10 Thread Ulrich Petri
New submission from Ulrich Petri: Importing a module that raises an exception on import trough `importlib.import_module()` causes importlib to not strip it's internal frames from the traceback. Minimal example: --a.py-- import importlib importlib.import_module("b") --a.py-- --b.py-- raise