]> granicus.if.org Git - python/commit
fix up signedness in PyImport_ExtendInittab (#4831)
authorBenjamin Peterson <benjamin@python.org>
Sat, 16 Dec 2017 07:42:33 +0000 (23:42 -0800)
committerGitHub <noreply@github.com>
Sat, 16 Dec 2017 07:42:33 +0000 (23:42 -0800)
commit0c644fcda095b12eedfb417f15429795c09196b6
tree5d1230628200ffa2c524269da9bc6781493a11c1
parent9454060e84a669dde63824d9e2fcaf295e34f687
fix up signedness in PyImport_ExtendInittab (#4831)

As a result of 92a3c6f493ad411e4cf0acdf305ef4876aa90669, the compiler complains:

Python/import.c:2311:21: warning: comparison of integers of different signs: 'long' and 'unsigned long' [-Wsign-compare]
    if ((i + n + 1) <= PY_SSIZE_T_MAX / sizeof(struct _inittab)) {
         ~~~~~~~~~  ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This overflow is extremely unlikely to happen, but let's avoid undefined
behavior anyway.
Python/import.c