-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
gh-112087: Store memory allocation information into _PyListArray #116529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Objects/listobject.c
Outdated
PyObject **old_items = self->ob_item; | ||
if (self->ob_item) { | ||
if (allocated < new_allocated) { | ||
memcpy(&array->ob_item, self->ob_item, allocated * sizeof(PyObject*)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for catching shrink case, @colesbury
@@ -0,0 +1 @@ | |||
:class:`list` is now compatible with the implementation of :pep:`703`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR should be the final PR for #112087.
I think that we can close the issue, and after GIL is disabled, we can track relevant issues from a separate issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more thing I noticed here is that list.sort
should have a critical section
PPC related failure: Not related to this PR.
|
Objects/listobject.c
Outdated
#ifdef Py_GIL_DISABLED | ||
typedef struct { | ||
Py_ssize_t allocated; | ||
PyObject *ob_item; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be a flexible array member like:
PyObject *ob_item; | |
PyObject *ob_item[]; |
Like dk_indices
in PyDictKeysObject
cpython/Include/internal/pycore_dict.h
Line 167 in 1e68c4b
char dk_indices[]; /* char is required to avoid strict aliasing. */ |
@@ -0,0 +1 @@ | |||
:class:`list` is now compatible with the implementation of :pep:`703`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more thing I noticed here is that list.sort
should have a critical section
I will submit the PR right a way. |
list
objects thread-safe in--disable-gil
builds #112087