mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
SF bug #1242657: list(obj) can swallow KeyboardInterrupt
Fix over-aggressive PyErr_Clear(). The same code fragment appears in various guises in list.extend(), map(), filter(), zip(), and internally in PySequence_Tuple().
This commit is contained in:
parent
b285974c00
commit
a710b331da
4 changed files with 31 additions and 0 deletions
|
@ -1401,6 +1401,11 @@ PySequence_Tuple(PyObject *v)
|
|||
/* Guess result size and allocate space. */
|
||||
n = PyObject_Size(v);
|
||||
if (n < 0) {
|
||||
if (!PyErr_ExceptionMatches(PyExc_TypeError) &&
|
||||
!PyErr_ExceptionMatches(PyExc_AttributeError)) {
|
||||
Py_DECREF(it);
|
||||
return NULL;
|
||||
}
|
||||
PyErr_Clear();
|
||||
n = 10; /* arbitrary */
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue