[ python-Bugs-1682205 ] [PATCH] TypeError swallowing in UNPACK_SEQUENCE opcode
SourceForge.net
noreply at sourceforge.net
Fri Mar 16 16:22:39 CET 2007
Bugs item #1682205, was opened at 2007-03-16 17:22
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1682205&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Piet Delport (pjdelport)
Assigned to: Nobody/Anonymous (nobody)
Summary: [PATCH] TypeError swallowing in UNPACK_SEQUENCE opcode
Initial Comment:
When UNPACK_SEQUENCE unpacks an iterable, it replaces any TypeError raised by the iterator with a new, catch-all TypeError('unpack non-sequence') instance (and empty traceback). This message is less useful than the ones it's (presumably) intended to replace (raised by PyObject_GetIter(), via unpack_iterable()), and obviously wrong when the TypeError originates in unrelated user code.
The attached patch simply removes the check, which (as far as i can tell) has no ill effects.
Examples (without the patch):
>>> a, b, c = 7
TypeError: unpack non-sequence
>>> a, b = ( int(x) for x in ['5', ()] )
TypeError: unpack non-sequence
With the patch applied, these result in:
>>> a, b, c = 7
TypeError: 'int' object is not iterable
>>> a, b = ( int(x) for x in ['5', ()] )
TypeError: int() argument must be a string or a number, not 'tuple'
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1682205&group_id=5470
More information about the Python-bugs-list
mailing list