mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
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)) {
This commit is contained in:
parent
721e25c653
commit
d233796f7d
1 changed files with 1 additions and 1 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue