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().
This commit is contained in:
Zackery Spytz 2018-12-08 07:16:55 -07:00 committed by Serhiy Storchaka
parent f05df0a4b6
commit 99d56b5356
7 changed files with 25 additions and 30 deletions

View file

@ -2594,7 +2594,7 @@ makepathobject(const wchar_t *path, wchar_t delim)
Py_DECREF(v);
return NULL;
}
PyList_SetItem(v, i, w);
PyList_SET_ITEM(v, i, w);
if (*p == '\0')
break;
path = p+1;