-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
bpo-35441: Remove dead and buggy code related to PyList_SetItem() #11033
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1544,7 +1544,7 @@ array_array_fromlist(arrayobject *self, PyObject *list) | |
if (array_resize(self, old_size + n) == -1) | ||
return NULL; | ||
for (i = 0; i < n; i++) { | ||
PyObject *v = PyList_GetItem(list, i); | ||
PyObject *v = PyList_GET_ITEM(list, i); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is possible the the list change size when convert its items to C integers. Needed to check either that v != NULL, or that n == PyList_GET_SIZE() in a loop. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry. As this is a bug in the existing code, can I simply revert this change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is up to you. Either revert this change and create a separate PR for fixing this bug, or include a fix for it in this PR. |
||
if ((*self->ob_descr->setitem)(self, | ||
Py_SIZE(self) - n + i, v) != 0) { | ||
array_resize(self, old_size); | ||
|
@@ -1574,8 +1574,7 @@ array_array_tolist_impl(arrayobject *self) | |
PyObject *v = getarrayitem((PyObject *)self, i); | ||
if (v == NULL) | ||
goto error; | ||
if (PyList_SetItem(list, i, v) < 0) | ||
goto error; | ||
PyList_SET_ITEM(list, i, v); | ||
} | ||
return list; | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.