We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d30a139 commit 6b78b29Copy full SHA for 6b78b29
1 file changed
Modules/pwdmodule.c
@@ -326,15 +326,12 @@ pwd_getpwall_impl(PyObject *module)
326
#ifdef Py_GIL_DISABLED
327
PyMutex_Unlock(&getpwall_mutex);
328
#endif
329
- /* Deferred decref on entries created above and added to the list */
330
- Py_ssize_t n = PyList_Size(d);
331
- for (Py_ssize_t i = 0; i < n; ++i) {
332
- PyObject *entry = PyList_GetItem(d, i);
333
- Py_DECREF(entry);
+ /* Deferred decref on entries created above and added to the list. */
+ Py_ssize_t n = PyList_GET_SIZE(d);
+ while (--n >= 0) {
+ Py_DECREF(PyList_GET_ITEM(d, n));
334
}
335
if (failure) {
336
- /* If there was a failure we might have created an entry but not added
337
- * it: dec-ref that, if it exists, before clearing the list. */
338
Py_XDECREF(orphan);
339
Py_CLEAR(d);
340
0 commit comments