mirror of https://github.com/python/cpython
gh-105375: Improve array.array exception handling (#105594)
Fix a bug where 'tp_richcompare' could end up overwriting an exception.
This commit is contained in:
parent
01f4230460
commit
35cff545db
|
@ -0,0 +1,2 @@
|
|||
Fix a bug in :class:`array.array` where an exception could end up being
|
||||
overwritten.
|
|
@ -767,10 +767,12 @@ array_richcompare(PyObject *v, PyObject *w, int op)
|
|||
k = 1;
|
||||
for (i = 0; i < Py_SIZE(va) && i < Py_SIZE(wa); i++) {
|
||||
vi = getarrayitem(v, i);
|
||||
if (vi == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
wi = getarrayitem(w, i);
|
||||
if (vi == NULL || wi == NULL) {
|
||||
Py_XDECREF(vi);
|
||||
Py_XDECREF(wi);
|
||||
if (wi == NULL) {
|
||||
Py_DECREF(vi);
|
||||
return NULL;
|
||||
}
|
||||
k = PyObject_RichCompareBool(vi, wi, Py_EQ);
|
||||
|
|
Loading…
Reference in New Issue