summaryrefslogtreecommitdiffstats
path: root/Python/import.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-12-12 22:29:28 (GMT)
committerGitHub <noreply@github.com>2017-12-12 22:29:28 (GMT)
commitd233796f7d444c67fe51b7dd9521d548e650286f (patch)
treeb2e9ad99a30a73a826c9656ad919c8f9c55b8bbe /Python/import.c
parent721e25c6535d08bd3d4d891fb2b540472e19f899 (diff)
downloadcpython-d233796f7d444c67fe51b7dd9521d548e650286f.zip
cpython-d233796f7d444c67fe51b7dd9521d548e650286f.tar.gz
cpython-d233796f7d444c67fe51b7dd9521d548e650286f.tar.bz2
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)) {
Diffstat (limited to 'Python/import.c')
-rw-r--r--Python/import.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Python/import.c b/Python/import.c
index 892f3d1..d5dad1a 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);
}