mirror of
https://github.com/python/cpython.git
synced 2025-10-18 12:48:57 +00:00
SF Patch #871704: Py_SequenceFast can mask errors
(Contributed by Greg Chapman.) Since this only changes the error message, I doubt that it should be backported.
This commit is contained in:
parent
44a98237d8
commit
2fb702966c
1 changed files with 11 additions and 3 deletions
|
@ -1496,6 +1496,8 @@ PySequence_List(PyObject *v)
|
|||
PyObject *
|
||||
PySequence_Fast(PyObject *v, const char *m)
|
||||
{
|
||||
PyObject *it;
|
||||
|
||||
if (v == NULL)
|
||||
return null_error();
|
||||
|
||||
|
@ -1504,9 +1506,15 @@ PySequence_Fast(PyObject *v, const char *m)
|
|||
return v;
|
||||
}
|
||||
|
||||
v = PySequence_Tuple(v);
|
||||
if (v == NULL && PyErr_ExceptionMatches(PyExc_TypeError))
|
||||
it = PyObject_GetIter(v);
|
||||
if (it == NULL) {
|
||||
if (PyErr_ExceptionMatches(PyExc_TypeError))
|
||||
return type_error(m);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
v = PySequence_Tuple(it);
|
||||
Py_DECREF(it);
|
||||
|
||||
return v;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue