[Python-checkins] r54480 - in python/trunk: Lib/test/test_unpack.py Misc/NEWS Python/ceval.c

georg.brandl python-checkins at python.org
Wed Mar 21 10:00:48 CET 2007


Author: georg.brandl
Date: Wed Mar 21 10:00:39 2007
New Revision: 54480

Modified:
   python/trunk/Lib/test/test_unpack.py
   python/trunk/Misc/NEWS
   python/trunk/Python/ceval.c
Log:
Patch #1682205: a TypeError while unpacking an iterable is no longer
masked by a generic one with the message "unpack non-sequence".


Modified: python/trunk/Lib/test/test_unpack.py
==============================================================================
--- python/trunk/Lib/test/test_unpack.py	(original)
+++ python/trunk/Lib/test/test_unpack.py	Wed Mar 21 10:00:39 2007
@@ -55,7 +55,7 @@
     >>> a, b, c = 7
     Traceback (most recent call last):
       ...
-    TypeError: unpack non-sequence
+    TypeError: 'int' object is not iterable
 
 Unpacking tuple of wrong size
 

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Wed Mar 21 10:00:39 2007
@@ -12,6 +12,9 @@
 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

Modified: python/trunk/Python/ceval.c
==============================================================================
--- python/trunk/Python/ceval.c	(original)
+++ python/trunk/Python/ceval.c	Wed Mar 21 10:00:39 2007
@@ -1774,12 +1774,10 @@
 					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);


More information about the Python-checkins mailing list