gh-101765: Fix refcount issues in list and unicode pickling (#102265)

Followup from #101769.
This commit is contained in:
Jelle Zijlstra 2023-02-25 16:01:58 -08:00 committed by GitHub
parent a498de4c0e
commit d71edbd1b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View file

@ -14794,8 +14794,10 @@ unicodeiter_reduce(unicodeiterobject *it, PyObject *Py_UNUSED(ignored))
return Py_BuildValue("N(O)n", iter, it->it_seq, it->it_index);
} else {
PyObject *u = unicode_new_empty();
if (u == NULL)
if (u == NULL) {
Py_DECREF(iter);
return NULL;
}
return Py_BuildValue("N(N)", iter, u);
}
}