From: Victor Stinner Date: Tue, 12 Dec 2017 22:29:28 +0000 (+0100) Subject: import.c: Fix a GCC warning (#4822) X-Git-Tag: v3.7.0a4~160 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d233796f7d444c67fe51b7dd9521d548e650286f;p=python 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)) { --- diff --git a/Python/import.c b/Python/import.c index 892f3d1c6e..d5dad1a6a3 100644 --- a/Python/import.c +++ b/Python/import.c @@ -2308,7 +2308,7 @@ PyImport_ExtendInittab(struct _inittab *newtab) _PyMem_SetDefaultAllocator(PYMEM_DOMAIN_RAW, &old_alloc); /* 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); p = PyMem_RawRealloc(inittab_copy, size); }