Skip to content

Commit 22004fb

Browse files
committed
Pass len to copy_pointer_to_list_lock_held()
1 parent e2a4ea0 commit 22004fb

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

Modules/_ctypes/_ctypes.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5555,9 +5555,10 @@ Pointer_new(PyTypeObject *type, PyObject *args, PyObject *kw)
55555555
}
55565556

55575557
static int
5558-
copy_pointer_to_list_lock_held(PyObject *myself, PyObject *np, Py_ssize_t start, Py_ssize_t step)
5558+
copy_pointer_to_list_lock_held(PyObject *myself, PyObject *np, Py_ssize_t len,
5559+
Py_ssize_t start, Py_ssize_t step)
55595560
{
5560-
Py_ssize_t i, len;
5561+
Py_ssize_t i;
55615562
size_t cur;
55625563
for (cur = start, i = 0; i < len; cur += step, i++) {
55635564
PyObject *v = Pointer_item_lock_held(myself, cur);
@@ -5711,7 +5712,7 @@ Pointer_subscript(PyObject *myself, PyObject *item)
57115712

57125713
int res;
57135714
LOCK_PTR(self);
5714-
res = copy_pointer_to_list_lock_held(myself, np, start, step);
5715+
res = copy_pointer_to_list_lock_held(myself, np, len, start, step);
57155716
UNLOCK_PTR(self);
57165717
if (res < 0) {
57175718
Py_DECREF(np);

0 commit comments

Comments
 (0)