[issue26637] importlib: better error message when import fail during Python shutdown

2016-03-25 Thread Roundup Robot
Roundup Robot added the comment: New changeset e2c482b60776 by Victor Stinner in branch 'default': Issue #26637: Fix test_io https://hg.python.org/cpython/rev/e2c482b60776 -- ___ Python tracker

[issue26637] importlib: better error message when import fail during Python shutdown

2016-03-24 Thread Roundup Robot
Roundup Robot added the comment: New changeset 14c56f697a85 by Victor Stinner in branch 'default': Fix bug in __import__ during Python shutdown https://hg.python.org/cpython/rev/14c56f697a85 -- nosy: +python-dev ___ Python tracker

[issue26637] importlib: better error message when import fail during Python shutdown

2016-03-24 Thread STINNER Victor
Changes by STINNER Victor : -- resolution: -> fixed status: open -> closed ___ Python tracker ___

[issue26637] importlib: better error message when import fail during Python shutdown

2016-03-24 Thread STINNER Victor
STINNER Victor added the comment: > It's technically a change in semantics as it shifts what exception is raised, > so I wouldn't backport it. Ok, I'm fine with only changing Python 3.6. -- ___ Python tracker

[issue26637] importlib: better error message when import fail during Python shutdown

2016-03-24 Thread Brett Cannon
Brett Cannon added the comment: It's technically a change in semantics as it shifts what exception is raised, so I wouldn't backport it. -- ___ Python tracker

[issue26637] importlib: better error message when import fail during Python shutdown

2016-03-24 Thread STINNER Victor
STINNER Victor added the comment: Oh. And is it ok to apply this change to Python 2.7 and 3.5? -- ___ Python tracker ___

[issue26637] importlib: better error message when import fail during Python shutdown

2016-03-24 Thread STINNER Victor
STINNER Victor added the comment: I will reply to my own question: in fact, ImportError is more convenient. The "try/except ImportError" pattern is common, in some cases, it's acceptable to skip a whole module. For a direct example on import during Python shutdown, see the issue #21925:

[issue26637] importlib: better error message when import fail during Python shutdown

2016-03-24 Thread Brett Cannon
Brett Cannon added the comment: Either ImportError or TypeError. ImportError makes sense since this is directly related to import semantics while TypeError makes sense as we are saying None specifically is not allowed. -- ___ Python tracker

[issue26637] importlib: better error message when import fail during Python shutdown

2016-03-24 Thread STINNER Victor
STINNER Victor added the comment: Updated patch with a dot in the comment :-) Is ImportError the best exception in this case? -- Added file: http://bugs.python.org/file42277/importlib_shutdown-2.patch ___ Python tracker

[issue26637] importlib: better error message when import fail during Python shutdown

2016-03-24 Thread STINNER Victor
New submission from STINNER Victor: Example of script.py: - class Bla: def __del__(self): try: import except Exception as exc: print("import error: [%s] %r" % (type(exc), exc)) bla = Bla() -