mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +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
|
@ -2052,7 +2052,8 @@ raw_unicode_escape(PyObject *obj)
|
|||
{
|
||||
PyObject *repr;
|
||||
char *p;
|
||||
Py_ssize_t i, size, expandsize;
|
||||
Py_ssize_t i, size;
|
||||
size_t expandsize;
|
||||
void *data;
|
||||
unsigned int kind;
|
||||
|
||||
|
@ -2067,7 +2068,7 @@ raw_unicode_escape(PyObject *obj)
|
|||
else
|
||||
expandsize = 6;
|
||||
|
||||
if (size > PY_SSIZE_T_MAX / expandsize)
|
||||
if ((size_t)size > (size_t)PY_SSIZE_T_MAX / expandsize)
|
||||
return PyErr_NoMemory();
|
||||
repr = PyBytes_FromStringAndSize(NULL, expandsize * size);
|
||||
if (repr == NULL)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue