diff options
author | Tim Peters <tim.peters@gmail.com> | 2001-09-30 05:58:42 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2001-09-30 05:58:42 (GMT) |
commit | 8b13b3ede270bf6f7bf3427675e335ab0bd0f75b (patch) | |
tree | 91dd83bf24d7234cc68b50914cc883960e7df92f | |
parent | d38b1c74f3f28a3f9a73c142d9be83425adaa6e1 (diff) | |
download | cpython-8b13b3ede270bf6f7bf3427675e335ab0bd0f75b.zip cpython-8b13b3ede270bf6f7bf3427675e335ab0bd0f75b.tar.gz cpython-8b13b3ede270bf6f7bf3427675e335ab0bd0f75b.tar.bz2 |
SF bug [#466173] unpack TypeError unclear
Replaced 3 instances of "iter() of non-sequence" with
"iteration over non-sequence".
Restored "unpack non-sequence" for stuff like "a, b = 1".
-rw-r--r-- | Objects/abstract.c | 2 | ||||
-rw-r--r-- | Objects/classobject.c | 2 | ||||
-rw-r--r-- | Objects/typeobject.c | 2 | ||||
-rw-r--r-- | Python/ceval.c | 6 |
4 files changed, 8 insertions, 4 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c index ac95123..7a5305a 100644 --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -1859,7 +1859,7 @@ PyObject_GetIter(PyObject *o) if (f == NULL) { if (PySequence_Check(o)) return PySeqIter_New(o); - PyErr_SetString(PyExc_TypeError, "iter() of non-sequence"); + PyErr_SetString(PyExc_TypeError, "iteration over non-sequence"); return NULL; } else { diff --git a/Objects/classobject.c b/Objects/classobject.c index df10aa2..cef1894 100644 --- a/Objects/classobject.c +++ b/Objects/classobject.c @@ -1839,7 +1839,7 @@ instance_getiter(PyInstanceObject *self) } PyErr_Clear(); if ((func = instance_getattr(self, getitemstr)) == NULL) { - PyErr_SetString(PyExc_TypeError, "iter() of non-sequence"); + PyErr_SetString(PyExc_TypeError, "iteration over non-sequence"); return NULL; } Py_DECREF(func); diff --git a/Objects/typeobject.c b/Objects/typeobject.c index b8a4593..e5e7dcd 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -3261,7 +3261,7 @@ slot_tp_iter(PyObject *self) PyErr_Clear(); func = lookup_method(self, "__getitem__", &getitem_str); if (func == NULL) { - PyErr_SetString(PyExc_TypeError, "iter() of non-sequence"); + PyErr_SetString(PyExc_TypeError, "iteration over non-sequence"); return NULL; } Py_DECREF(func); diff --git a/Python/ceval.c b/Python/ceval.c index 731e93f..132fb72 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1556,8 +1556,12 @@ eval_frame(PyFrameObject *f) else if (unpack_iterable(v, oparg, stack_pointer + oparg)) stack_pointer += oparg; - else + else { + if (PyErr_ExceptionMatches(PyExc_TypeError)) + PyErr_SetString(PyExc_TypeError, + "unpack non-sequence"); why = WHY_EXCEPTION; + } Py_DECREF(v); break; |