bpo-36030: Fix a possible segfault in PyTuple_New() (GH-15670)

This commit is contained in:
Zackery Spytz 2019-09-04 07:58:05 -06:00 committed by Victor Stinner
parent 675d17cec4
commit 60bd1f88f2
1 changed files with 3 additions and 0 deletions

View File

@ -146,6 +146,9 @@ PyTuple_New(Py_ssize_t size)
}
#endif
op = tuple_alloc(size);
if (op == NULL) {
return NULL;
}
for (Py_ssize_t i = 0; i < size; i++) {
op->ob_item[i] = NULL;
}