diff options
author | Zackery Spytz <zspytz@gmail.com> | 2018-12-08 07:16:55 -0700 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2018-12-08 16:16:55 +0200 |
commit | 99d56b53560b3867844472ae381fb3f858760621 (patch) | |
tree | f81865ef12567f144d7eaf3adf8b61c136945a55 /Modules/selectmodule.c | |
parent | bpo-35330: Don't call the wrapped object if `side_effect` is set (GH10973) (diff) | |
download | cpython-99d56b53560b3867844472ae381fb3f858760621.tar.gz cpython-99d56b53560b3867844472ae381fb3f858760621.tar.bz2 cpython-99d56b53560b3867844472ae381fb3f858760621.zip |
bpo-35441: Remove dead and buggy code related to PyList_SetItem(). (GH-11033)
In _localemodule.c and selectmodule.c, remove dead code that would
cause double decrefs if run.
In addition, replace PyList_SetItem() with PyList_SET_ITEM() in cases
where a new list is populated and there is no possibility of an error.
In addition, check if the list changed size in the loop in array_array_fromlist().
Diffstat (limited to 'Modules/selectmodule.c')
-rw-r--r-- | Modules/selectmodule.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c index fe69cd58dc6..7f62ab111d1 100644 --- a/Modules/selectmodule.c +++ b/Modules/selectmodule.c @@ -693,10 +693,7 @@ select_poll_poll_impl(pollObject *self, PyObject *timeout_obj) goto error; } PyTuple_SET_ITEM(value, 1, num); - if ((PyList_SetItem(result_list, j, value)) == -1) { - Py_DECREF(value); - goto error; - } + PyList_SET_ITEM(result_list, j, value); i++; } return result_list; @@ -986,10 +983,7 @@ select_devpoll_poll_impl(devpollObject *self, PyObject *timeout_obj) Py_DECREF(num2); if (value == NULL) goto error; - if ((PyList_SetItem(result_list, i, value)) == -1) { - Py_DECREF(value); - goto error; - } + PyList_SET_ITEM(result_list, i, value); } return result_list; |