[Python-checkins] r54481 - in python/branches/release25-maint: Lib/test/test_unpack.py Misc/NEWS Python/ceval.c

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


Author: georg.brandl
Date: Wed Mar 21 10:00:55 2007
New Revision: 54481

Modified:
   python/branches/release25-maint/Lib/test/test_unpack.py
   python/branches/release25-maint/Misc/NEWS
   python/branches/release25-maint/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".
 (backport from rev. 54480)

Modified: python/branches/release25-maint/Lib/test/test_unpack.py
==============================================================================
--- python/branches/release25-maint/Lib/test/test_unpack.py	(original)
+++ python/branches/release25-maint/Lib/test/test_unpack.py	Wed Mar 21 10:00:55 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/branches/release25-maint/Misc/NEWS
==============================================================================
--- python/branches/release25-maint/Misc/NEWS	(original)
+++ python/branches/release25-maint/Misc/NEWS	Wed Mar 21 10:00:55 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".
+
 - Patch #1642547: Fix an error/crash when encountering syntax errors in
   complex if statements.
 

Modified: python/branches/release25-maint/Python/ceval.c
==============================================================================
--- python/branches/release25-maint/Python/ceval.c	(original)
+++ python/branches/release25-maint/Python/ceval.c	Wed Mar 21 10:00:55 2007
@@ -1765,12 +1765,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