diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-08-15 23:03:39 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-08-15 23:03:39 (GMT) |
commit | 706768c687f5413c909168736506aaf4fb4861c0 (patch) | |
tree | 98131f201f269d30031ed6e3c6d98fe4cf1fe649 /Modules/_tracemalloc.c | |
parent | 12174a5dcaf1bdcd8d5fd790a8cad07049bddce6 (diff) | |
download | cpython-706768c687f5413c909168736506aaf4fb4861c0.zip cpython-706768c687f5413c909168736506aaf4fb4861c0.tar.gz cpython-706768c687f5413c909168736506aaf4fb4861c0.tar.bz2 |
Issue #22156: Fix some "comparison between signed and unsigned integers"
compiler warnings in the Modules/ subdirectory.
Diffstat (limited to 'Modules/_tracemalloc.c')
-rw-r--r-- | Modules/_tracemalloc.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Modules/_tracemalloc.c b/Modules/_tracemalloc.c index 257ae1b..e0024e9 100644 --- a/Modules/_tracemalloc.c +++ b/Modules/_tracemalloc.c @@ -79,7 +79,7 @@ typedef struct { (sizeof(traceback_t) + sizeof(frame_t) * (NFRAME - 1)) #define MAX_NFRAME \ - ((INT_MAX - sizeof(traceback_t)) / sizeof(frame_t) + 1) + (((size_t)INT_MAX - sizeof(traceback_t)) / sizeof(frame_t) + 1) static PyObject *unknown_filename = NULL; static traceback_t tracemalloc_empty_traceback; @@ -874,7 +874,7 @@ tracemalloc_start(int max_nframe) return 0; } - assert(1 <= max_nframe && max_nframe <= MAX_NFRAME); + assert(1 <= max_nframe && (size_t)max_nframe <= MAX_NFRAME); tracemalloc_config.max_nframe = max_nframe; /* allocate a buffer to store a new traceback */ @@ -1226,7 +1226,7 @@ py_tracemalloc_start(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "|n:start", &nframe)) return NULL; - if (nframe < 1 || nframe > MAX_NFRAME) { + if (nframe < 1 || (size_t)nframe > MAX_NFRAME) { PyErr_Format(PyExc_ValueError, "the number of frames must be in range [1; %i]", (int)MAX_NFRAME); @@ -1388,7 +1388,7 @@ parse_sys_xoptions(PyObject *value) if (nframe == -1 && PyErr_Occurred()) return -1; - if (nframe < 1 || nframe > MAX_NFRAME) + if (nframe < 1 || (size_t)nframe > MAX_NFRAME) return -1; return Py_SAFE_DOWNCAST(nframe, long, int); @@ -1412,7 +1412,7 @@ _PyTraceMalloc_Init(void) value = strtol(p, &endptr, 10); if (*endptr != '\0' || value < 1 - || value > MAX_NFRAME + || (size_t)value > MAX_NFRAME || errno == ERANGE) { Py_FatalError("PYTHONTRACEMALLOC: invalid number of frames"); |