From b7eed5f40eb1b371a93ab907c6ed1cd8295ea7b2 Mon Sep 17 00:00:00 2001 From: Starbuck5 <46412508+Starbuck5@users.noreply.github.com> Date: Tue, 26 Nov 2024 23:07:50 -0800 Subject: [PATCH] Error check PyNumber_AsSsize_t in rect_impl.h --- src_c/rect_impl.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src_c/rect_impl.h b/src_c/rect_impl.h index 0deafbcef4..27df1bc315 100644 --- a/src_c/rect_impl.h +++ b/src_c/rect_impl.h @@ -2161,6 +2161,9 @@ RectExport_subscript(RectObject *self, PyObject *op) if (PyIndex_Check(op)) { Py_ssize_t i = PyNumber_AsSsize_t(op, NULL); + if (i == -1 && PyErr_Occurred()) { + return NULL; + } return RectExport_item(self, i); } else if (op == Py_Ellipsis) { @@ -2207,6 +2210,9 @@ RectExport_assSubscript(RectObject *self, PyObject *op, PyObject *value) } if (PyIndex_Check(op)) { Py_ssize_t i = PyNumber_AsSsize_t(op, NULL); + if (i == -1 && PyErr_Occurred()) { + return -1; + } return RectExport_assItem(self, i, value); } else if (op == Py_Ellipsis) {