Kaydet (Commit) 8b13b3ed authored tarafından Tim Peters's avatar Tim Peters

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".
üst d38b1c74
......@@ -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 {
......
......@@ -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);
......
......@@ -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);
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment