Eric Snow added the comment:
Issue15425 is related. I'm looking into an exception chaining approach that
could be applied for this issue too.
--
nosy: +eric.snow
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15110
Roundup Robot devn...@psf.upfronthosting.co.za added the comment:
New changeset 8c877ad00bc4 by Antoine Pitrou in branch 'default':
Issue #15110: Fix the tracebacks generated by import xxx to not show the
importlib stack frames.
http://hg.python.org/cpython/rev/8c877ad00bc4
--
nosy:
Antoine Pitrou pit...@free.fr added the comment:
Thanks, Brett!
--
resolution: - fixed
stage: commit review - committed/rejected
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15110
Amaury Forgeot d'Arc amaur...@gmail.com added the comment:
I really like the _exec_module trick, but it should be applied to builtin
modules as well. I hacked _sre.c and got:
~/python/cpython3.x$ ./python
Traceback (most recent call last):
File /home/amauryfa/python/cpython3.x/Lib/site.py,
Brett Cannon br...@python.org added the comment:
Re-opening so Antoine can look at Amaury's proposed fix for builtin modules.
--
status: closed - open
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15110
Antoine Pitrou pit...@free.fr added the comment:
I really like the _exec_module trick, but it should be applied to
builtin modules as well. I hacked _sre.c and got:
I hadn't thought about this one. Can you apply your patch?
--
___
Python tracker
Roundup Robot devn...@psf.upfronthosting.co.za added the comment:
New changeset 37e68da59047 by Amaury Forgeot d'Arc in branch 'default':
Issue #15110: Also hide importlib frames when importing a builtin module fails.
http://hg.python.org/cpython/rev/37e68da59047
--
Roundup Robot devn...@psf.upfronthosting.co.za added the comment:
New changeset 5d43154d68a8 by Amaury Forgeot d'Arc in branch 'default':
Issue #15110: Copy same docstring as other '_exec_module' methods.
http://hg.python.org/cpython/rev/5d43154d68a8
--
Antoine Pitrou pit...@free.fr added the comment:
Here is a patch with tests. Brett, what do you think?
--
stage: - patch review
Added file: http://bugs.python.org/file26308/trim_tb.patch
___
Python tracker rep...@bugs.python.org
Antoine Pitrou pit...@free.fr added the comment:
By the way, it has to be done in C since tb_next can't be modified from Python
code.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15110
Amaury Forgeot d'Arc amaur...@gmail.com added the comment:
Does it work for extension modules?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15110
___
Antoine Pitrou pit...@free.fr added the comment:
Does it work for extension modules?
What do you mean?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15110
___
Amaury Forgeot d'Arc amaur...@gmail.com added the comment:
I added to _ssl.c:
PyErr_SetString(PyExc_ValueError, Just a test);
return NULL;
Then I tried to import the module:
~/python/cpython3.x$ ./python -c import ssl
Traceback (most recent call last):
File string, line 1, in module
Amaury Forgeot d'Arc amaur...@gmail.com added the comment:
See also msg164937
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15110
___
___
Antoine Pitrou pit...@free.fr added the comment:
Ah, right, here is an updated patch which also handles extension modules and
frozen ones.
--
Added file: http://bugs.python.org/file26312/trim_tb2.patch
___
Python tracker rep...@bugs.python.org
Brett Cannon br...@python.org added the comment:
Looks good to me. Go ahead and commit it.
--
assignee: brett.cannon - pitrou
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15110
___
Changes by Brett Cannon br...@python.org:
--
stage: patch review - commit review
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15110
___
___
Georg Brandl ge...@python.org added the comment:
Setting to blocker for b2.
--
priority: critical - release blocker
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15110
___
Amaury Forgeot d'Arc amaur...@gmail.com added the comment:
Here is a patch which removes frozen importlib._bootstrap frames from
tracebacks. Tests are missing, but this gives good result on the few samples I
tried.
python -v does not suppress importlib frames.
--
keywords: +patch
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:
--
nosy: +Arfrever
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15110
___
Antoine Pitrou pit...@free.fr added the comment:
Wouldn't it be better to do it in pure Python in importlib itself?
--
nosy: +pitrou
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15110
___
Amaury Forgeot d'Arc amaur...@gmail.com added the comment:
I tried to do it in importlib, with code like
raise original_exception.with_traceback(trimmed_traceback)
but the function containing this very line would always be part of the
displayed stack trace.
--
Antoine Pitrou pit...@free.fr added the comment:
Perhaps at least the trimming should only be done for ImportErrors, then?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15110
___
Amaury Forgeot d'Arc amaur...@gmail.com added the comment:
No, the example above is a SyntaxError, and I claim the importlib frames should
be removed as well.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15110
Antoine Pitrou pit...@free.fr added the comment:
Ah, you're right. But it could become confusing if some error is raised inside
of importlib itself (not an ImportError, something else - perhaps a bug).
So I would suggest the following:
- trim ImportErrors
- trim errors raised when executing
Changes by Dave Malcolm dmalc...@redhat.com:
--
nosy: +dmalcolm
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15110
___
___
Python-bugs-list
Antoine Pitrou pit...@free.fr added the comment:
About this proposal:
- trim errors raised when executing the code of an imported module (i.e. in
_LoaderBasics._load_module())
The exec() could be isolated in a distinctly-named submethod (e.g.
_exec_module()), so that it is easy to detect
Georg Brandl ge...@python.org added the comment:
I agree that this is not helpful at all in the usual case, i.e. when you
*don't* want to debug importlib. The one frame in actual user code (distutils
in this case) in the middle is kind of hard to spot, but it is what you want to
know. Note
Changes by Georg Brandl ge...@python.org:
--
nosy: +gvanrossum
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15110
___
___
Python-bugs-list
New submission from Amaury Forgeot d'Arc amaur...@gmail.com:
Exceptions during import now display huge tracebacks across
importlib._bootstrap, this adds a lot of noise to the error:
For example, I added some syntax error in distutils/spawn.py, then:
~/python/cpython3.x$ ./python -c from
R. David Murray rdmur...@bitdance.com added the comment:
importlib is written in python. So you get a python traceback of its execution
stack. Yes it is noisy, but I'm not sure that this should be changed, or we'd
lose some of the benefit of having importlib written in python. (It also
31 matches
Mail list logo