]> granicus.if.org Git - python/commitdiff
Patch #1682205: a TypeError while unpacking an iterable is no longer
authorGeorg Brandl <georg@python.org>
Wed, 21 Mar 2007 09:00:39 +0000 (09:00 +0000)
committerGeorg Brandl <georg@python.org>
Wed, 21 Mar 2007 09:00:39 +0000 (09:00 +0000)
masked by a generic one with the message "unpack non-sequence".

Lib/test/test_unpack.py
Misc/NEWS
Python/ceval.c

index 3f726487e0a91bc6991ae579a80601f56f45639f..76a4822804804bee06ff35019fec3cec4d76d5a8 100644 (file)
@@ -55,7 +55,7 @@ Unpacking non-sequence
     >>> a, b, c = 7
     Traceback (most recent call last):
       ...
-    TypeError: unpack non-sequence
+    TypeError: 'int' object is not iterable
 
 Unpacking tuple of wrong size
 
index c69b3ea95941c21c663ebb0d2d197804a23f9de5..a9d05e059d27f365691e7126fa12003272e098ed 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,9 @@ What's New in Python 2.6 alpha 1?
 Core and builtins
 -----------------
 
+- Patch #1682205: a TypeError while unpacking an iterable is no longer
+  masked by a generic one with the message "unpack non-sequence".
+
 - Remove unused file Python/fmod.c.
 
 - Patch #1675423: PyComplex_AsCComplex() now tries to convert an object
index 63efd4ee958d7eefcd5338ec6423e30b86a1960b..b35942d7b90aae2e6d86500e942cc62b3ab5658f 100644 (file)
@@ -1774,12 +1774,10 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
                                        PUSH(w);
                                }
                        } else if (unpack_iterable(v, oparg,
-                                                stack_pointer + oparg))
+                                                stack_pointer + oparg)) {
                                stack_pointer += oparg;
-                       else {
-                               if (PyErr_ExceptionMatches(PyExc_TypeError))
-                                       PyErr_SetString(PyExc_TypeError,
-                                               "unpack non-sequence");
+                       } else {
+                               /* unpack_iterable() raised an exception */
                                why = WHY_EXCEPTION;
                        }
                        Py_DECREF(v);