[Patches] [ python-Patches-1682205 ] TypeError swallowing in UNPACK_SEQUENCE opcode

SourceForge.net noreply at sourceforge.net
Sat Mar 17 16:49:32 CET 2007


Patches item #1682205, was opened at 2007-03-16 15:22
Message generated for change (Comment added) made by gbrandl
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&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: None
>Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Piet Delport (pjdelport)
Assigned to: Nobody/Anonymous (nobody)
>Summary: 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'


----------------------------------------------------------------------

>Comment By: Georg Brandl (gbrandl)
Date: 2007-03-17 15:49

Message:
Logged In: YES 
user_id=849994
Originator: NO

It's patch, after all :)

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1682205&group_id=5470


More information about the Patches mailing list