mirror of https://github.com/python/cpython
Rewrite the list_inline_repeat overflow check slightly differently.
This commit is contained in:
parent
1c4282b41b
commit
ee6bab06d3
|
@ -672,10 +672,11 @@ list_inplace_repeat(PyListObject *self, Py_ssize_t n)
|
||||||
return (PyObject *)self;
|
return (PyObject *)self;
|
||||||
}
|
}
|
||||||
|
|
||||||
p = size*n;
|
if (size > SSIZE_MAX / n) {
|
||||||
if (p/n != size)
|
|
||||||
return PyErr_NoMemory();
|
return PyErr_NoMemory();
|
||||||
if (list_resize(self, p) == -1)
|
}
|
||||||
|
|
||||||
|
if (list_resize(self, size*n) == -1)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
p = size;
|
p = size;
|
||||||
|
|
Loading…
Reference in New Issue