Commit d233796f authored by Victor Stinner's avatar Victor Stinner Committed by GitHub

import.c: Fix a GCC warning (#4822)

Fix the warning:

Python/import.c: warning: comparison between signed and unsigned integer expressions
     if ((i + n + 1) <= PY_SSIZE_T_MAX / sizeof(struct _inittab)) {
parent 721e25c6
...@@ -2308,7 +2308,7 @@ PyImport_ExtendInittab(struct _inittab *newtab) ...@@ -2308,7 +2308,7 @@ PyImport_ExtendInittab(struct _inittab *newtab)
_PyMem_SetDefaultAllocator(PYMEM_DOMAIN_RAW, &old_alloc); _PyMem_SetDefaultAllocator(PYMEM_DOMAIN_RAW, &old_alloc);
/* Allocate new memory for the combined table */ /* Allocate new memory for the combined table */
if ((i + n + 1) <= PY_SSIZE_T_MAX / sizeof(struct _inittab)) { if ((i + n + 1) <= PY_SSIZE_T_MAX / (Py_ssize_t)sizeof(struct _inittab)) {
size_t size = sizeof(struct _inittab) * (i + n + 1); size_t size = sizeof(struct _inittab) * (i + n + 1);
p = PyMem_RawRealloc(inittab_copy, size); p = PyMem_RawRealloc(inittab_copy, size);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment