mirror of
https://github.com/python/cpython.git
synced 2025-08-28 12:45:07 +00:00
Issue #22207: Fix "comparison between signed and unsigned integers" warning in
test checking for integer overflow on Py_ssize_t type: cast explicitly to size_t.
This commit is contained in:
parent
daca3d7e9b
commit
049e509a9f
8 changed files with 21 additions and 19 deletions
|
@ -97,7 +97,7 @@ PyTuple_New(Py_ssize_t size)
|
|||
#endif
|
||||
{
|
||||
/* Check for overflow */
|
||||
if (size > (PY_SSIZE_T_MAX - sizeof(PyTupleObject) -
|
||||
if ((size_t)size > ((size_t)PY_SSIZE_T_MAX - sizeof(PyTupleObject) -
|
||||
sizeof(PyObject *)) / sizeof(PyObject *)) {
|
||||
return PyErr_NoMemory();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue