Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Bugs

[issue15486] Standardised mechanism for stripping importlib frames from tracebacks

 

 

Python bugs RSS feed   Index | Next | Previous | View Threaded


report at bugs

Jul 29, 2012, 4:28 AM

Post #1 of 15 (195 views)
Permalink
[issue15486] Standardised mechanism for stripping importlib frames from tracebacks

Nick Coghlan added the comment:

In trying to find a new case that wasn't already covered by the test suite, I found an error which I'm not even sure should be an error. Doesn't 3.2 suppress failures that occur when attempting to implicitly cache the .pyc?

Anyway, given the rest of the patch, trimming this traceback will be easy if we decide that's the right thing to do.

----------
components: +Interpreter Core, Library (Lib)
keywords: +patch
nosy: +amaury.forgeotdarc, brett.cannon, eric.snow, georg.brandl
priority: normal -> release blocker
stage: -> patch review
title: Standardise the mechanisms for stripping importlib frames -> Standardised mechanism for stripping importlib frames from tracebacks
type: -> behavior
versions: +Python 3.3
Added file: http://bugs.python.org/file26573/issue15486_simplify_importlib_frame_removal.diff

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15486>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Jul 29, 2012, 4:54 AM

Post #2 of 15 (192 views)
Permalink
[issue15486] Standardised mechanism for stripping importlib frames from tracebacks [In reply to]

Changes by Arfrever Frehtes Taifersar Arahesis <Arfrever.FTA [at] GMail>:


----------
nosy: +Arfrever

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15486>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Jul 29, 2012, 6:44 AM

Post #3 of 15 (186 views)
Permalink
[issue15486] Standardised mechanism for stripping importlib frames from tracebacks [In reply to]

Chris Jerdonek added the comment:

The test cases uploaded to issue 7559 ("TestLoader.loadTestsFromName swallows import errors") a while back contain a number of distinct cases (four, I think) in which an import error can be raised. IIRC, these include a couple recursive scenarios (cyclical import from within __init__.py, etc).

Those test cases were designed specifically to cover different scenarios in which unittest's loader was swallowing import errors. Might be worth taking a look.

----------
nosy: +cjerdonek

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15486>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Jul 29, 2012, 7:50 AM

Post #4 of 15 (188 views)
Permalink
[issue15486] Standardised mechanism for stripping importlib frames from tracebacks [In reply to]

Antoine Pitrou added the comment:

This is an elegant solution, +1 from me.

----------
nosy: +pitrou

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15486>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Jul 29, 2012, 9:35 AM

Post #5 of 15 (190 views)
Permalink
[issue15486] Standardised mechanism for stripping importlib frames from tracebacks [In reply to]

Changes by Meador Inge <meadori [at] gmail>:


----------
nosy: +meador.inge

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15486>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Jul 29, 2012, 10:45 AM

Post #6 of 15 (187 views)
Permalink
[issue15486] Standardised mechanism for stripping importlib frames from tracebacks [In reply to]

Antoine Pitrou added the comment:

That said, given the nature of the patch (a cleanup without any functional impact), I don't think it should be a release blocker.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15486>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Jul 29, 2012, 6:28 PM

Post #7 of 15 (187 views)
Permalink
[issue15486] Standardised mechanism for stripping importlib frames from tracebacks [In reply to]

Nick Coghlan added the comment:

The "release blocker" status comes from the test case I added in order to demonstrate the ability to strip a new frame sequence without needing to modify the C code.

Currently that test (failing to write the PYC file) fails with an IsADirectory traceback that includes a lot of importlib frames.

There are two possible solutions:
- redirect the affected call through "_call_with_frames_removed" but otherwise leave the failure intact
- change it so this particular case isn't a fatal error

I need to check if failing to write the .pyc was a fatal error in 3.2 before I decide how to fix it (unless someone else remembers off the top of their head)

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15486>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Jul 30, 2012, 4:06 AM

Post #8 of 15 (182 views)
Permalink
[issue15486] Standardised mechanism for stripping importlib frames from tracebacks [In reply to]

Nick Coghlan added the comment:

OK, after a bit of experimentation, it appears both 3.2 and 3.3 eventually get annoyed if you mess about too much with __pycache__.

1. They're both fine if __pycache__ is entirely unwritable (they just silently skip caching the bytecode)

2. 3.2 throws EOFError if you replace the cache entry with an empty file, 3.3 silently rewrites it with a valid cached version

3. 3.2 throws EOFError if you replace the cache entry with a directory, 3.3 throws a more accurate IsADirectory error

That means my chosen test case is a valid one, and I can just update the offending call in importlib._bootrap to use the new frame stripping hook as I originally planned.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15486>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Jul 30, 2012, 4:23 AM

Post #9 of 15 (184 views)
Permalink
[issue15486] Standardised mechanism for stripping importlib frames from tracebacks [In reply to]

Nick Coghlan added the comment:

Looking at the actual code - I don't think it actually makes sense to strip the frames in this case. Unlike the previous examples, it only comes up if someone is doing something deliberately pathological, at which point a little noise in the traceback is the least of your worries.

Updated patch just drops that test case entirely and only has the changes that simplify the frame removal code. Since Georg isn't on IRC right now, assigning him to decide if he wants this version in beta 2 rather than the current "multiple exit points" approach.

----------
assignee: -> georg.brandl
Added file: http://bugs.python.org/file26597/issue15486_simplify_importlib_frame_removal_no_new_test.diff

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15486>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Jul 30, 2012, 4:23 AM

Post #10 of 15 (178 views)
Permalink
[issue15486] Standardised mechanism for stripping importlib frames from tracebacks [In reply to]

Changes by Nick Coghlan <ncoghlan [at] gmail>:


Removed file: http://bugs.python.org/file26573/issue15486_simplify_importlib_frame_removal.diff

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15486>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Jul 30, 2012, 10:06 AM

Post #11 of 15 (185 views)
Permalink
[issue15486] Standardised mechanism for stripping importlib frames from tracebacks [In reply to]

Georg Brandl added the comment:

Looks good and simplifies things. Green light :)

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15486>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Jul 30, 2012, 7:08 PM

Post #12 of 15 (185 views)
Permalink
[issue15486] Standardised mechanism for stripping importlib frames from tracebacks [In reply to]

Eric Snow added the comment:

patch LGTM. Nice and clean.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15486>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Jul 30, 2012, 7:22 PM

Post #13 of 15 (181 views)
Permalink
[issue15486] Standardised mechanism for stripping importlib frames from tracebacks [In reply to]

Changes by Atsuo Ishimoto <ishimoto [at] gembook>:


----------
nosy: +ishimoto

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15486>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Jul 31, 2012, 4:14 AM

Post #14 of 15 (181 views)
Permalink
[issue15486] Standardised mechanism for stripping importlib frames from tracebacks [In reply to]

Roundup Robot added the comment:

New changeset 62033490ca0f by Nick Coghlan in branch 'default':
Close #15486: Simplify the mechanism used to remove importlib frames from tracebacks when they just introduce irrelevant noise
http://hg.python.org/cpython/rev/62033490ca0f

----------
nosy: +python-dev
resolution: -> fixed
stage: patch review -> committed/rejected
status: open -> closed

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15486>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 3, 2012, 8:38 AM

Post #15 of 15 (168 views)
Permalink
[issue15486] Standardised mechanism for stripping importlib frames from tracebacks [In reply to]

Changes by Jesús Cea Avión <jcea [at] jcea>:


----------
nosy: +jcea

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15486>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com

Python bugs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.