summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Lib/test/test_unpack.py2
-rw-r--r--Misc/NEWS3
-rw-r--r--Python/ceval.c8
3 files changed, 7 insertions, 6 deletions
diff --git a/Lib/test/test_unpack.py b/Lib/test/test_unpack.py
index 3f726487e0..76a4822804 100644
--- a/Lib/test/test_unpack.py
+++ b/Lib/test/test_unpack.py
@@ -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
diff --git a/Misc/NEWS b/Misc/NEWS
index 2eea8b9d9f..d8c8871008 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,9 @@ What's New in Python 2.5.1c1?
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.
diff --git a/Python/ceval.c b/Python/ceval.c
index 690b2be9b7..9dddd2ff2f 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -1765,12 +1765,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);