Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Address code review
  • Loading branch information
corona10 committed Mar 9, 2024
commit a60d9cb9d8a73968ada7dc9431f1444d83dbb427
10 changes: 5 additions & 5 deletions Objects/listobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ get_list_freelist(void)
#ifdef Py_GIL_DISABLED
typedef struct {
Py_ssize_t allocated;
PyObject *ob_item;
PyObject *ob_item[];
} _PyListArray;

static _PyListArray *
Expand Down Expand Up @@ -138,7 +138,7 @@ list_resize(PyListObject *self, Py_ssize_t newsize)
else {
target_bytes = allocated * sizeof(PyObject*);
}
memcpy(&array->ob_item, self->ob_item, target_bytes);
memcpy(array->ob_item, self->ob_item, target_bytes);
}
_Py_atomic_store_ptr_release(&self->ob_item, &array->ob_item);
Comment thread
corona10 marked this conversation as resolved.
self->allocated = new_allocated;
Expand Down Expand Up @@ -186,7 +186,7 @@ list_preallocate_exact(PyListObject *self, Py_ssize_t size)
PyErr_NoMemory();
return -1;
}
items = &array->ob_item;
items = array->ob_item;
#else
items = PyMem_New(PyObject*, size);
if (items == NULL) {
Expand Down Expand Up @@ -264,7 +264,7 @@ PyList_New(Py_ssize_t size)
return PyErr_NoMemory();
}
memset(&array->ob_item, 0, size * sizeof(PyObject *));
op->ob_item = &array->ob_item;
op->ob_item = array->ob_item;
#else
op->ob_item = (PyObject **) PyMem_Calloc(size, sizeof(PyObject *));
#endif
Expand Down Expand Up @@ -294,7 +294,7 @@ list_new_prealloc(Py_ssize_t size)
Py_DECREF(op);
return PyErr_NoMemory();
}
op->ob_item = &array->ob_item;
op->ob_item = array->ob_item;
#else
op->ob_item = PyMem_New(PyObject *, size);
if (op->ob_item == NULL) {
Expand Down