Fix _getxy refcount leaks (#9487)

This commit is contained in:
Hugo van Kemenade 2026-03-25 14:00:18 +02:00 committed by GitHub
parent 3a83d6abc3
commit 9a89944e73
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1216,7 +1216,9 @@ _getxy(PyObject *xy, int *x, int *y) {
PyObject *int_value = PyObject_CallMethod(value, "__int__", NULL);
if (int_value != NULL && PyLong_Check(int_value)) {
*x = PyLong_AS_LONG(int_value);
Py_DECREF(int_value);
} else {
Py_XDECREF(int_value);
goto badval;
}
}
@ -1230,7 +1232,9 @@ _getxy(PyObject *xy, int *x, int *y) {
PyObject *int_value = PyObject_CallMethod(value, "__int__", NULL);
if (int_value != NULL && PyLong_Check(int_value)) {
*y = PyLong_AS_LONG(int_value);
Py_DECREF(int_value);
} else {
Py_XDECREF(int_value);
goto badval;
}
}