Skip to content

Commit

Permalink
Error check PyNumber_AsSsize_t in rect_impl.h
Browse files Browse the repository at this point in the history
  • Loading branch information
Starbuck5 committed Nov 27, 2024
1 parent 6ba909b commit b7eed5f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src_c/rect_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit b7eed5f

Please sign in to comment.