diff options
author | Benjamin Peterson <benjamin@python.org> | 2016-09-07 16:26:18 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2016-09-07 16:26:18 (GMT) |
commit | 2f8bfef1587b3e8f43c0ce7cd9546137c5b56782 (patch) | |
tree | 44becf9ee303c3cd1e8977fbda8cbbe42237258a /Objects | |
parent | c75abff53375bbd9f1536de4069854cea4933c42 (diff) | |
download | cpython-2f8bfef1587b3e8f43c0ce7cd9546137c5b56782.zip cpython-2f8bfef1587b3e8f43c0ce7cd9546137c5b56782.tar.gz cpython-2f8bfef1587b3e8f43c0ce7cd9546137c5b56782.tar.bz2 |
replace PY_SIZE_MAX with SIZE_MAX
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/listobject.c | 4 | ||||
-rw-r--r-- | Objects/longobject.c | 2 | ||||
-rw-r--r-- | Objects/obmalloc.c | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c index 90bbf2a..dcd7b5e 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -49,7 +49,7 @@ list_resize(PyListObject *self, Py_ssize_t newsize) new_allocated = (newsize >> 3) + (newsize < 9 ? 3 : 6); /* check for integer overflow */ - if (new_allocated > PY_SIZE_MAX - newsize) { + if (new_allocated > SIZE_MAX - newsize) { PyErr_NoMemory(); return -1; } else { @@ -59,7 +59,7 @@ list_resize(PyListObject *self, Py_ssize_t newsize) if (newsize == 0) new_allocated = 0; items = self->ob_item; - if (new_allocated <= (PY_SIZE_MAX / sizeof(PyObject *))) + if (new_allocated <= (SIZE_MAX / sizeof(PyObject *))) PyMem_RESIZE(items, PyObject *, new_allocated); else items = NULL; diff --git a/Objects/longobject.c b/Objects/longobject.c index 6eb40e4..740b7f5 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -721,7 +721,7 @@ _PyLong_NumBits(PyObject *vv) assert(ndigits == 0 || v->ob_digit[ndigits - 1] != 0); if (ndigits > 0) { digit msd = v->ob_digit[ndigits - 1]; - if ((size_t)(ndigits - 1) > PY_SIZE_MAX / (size_t)PyLong_SHIFT) + if ((size_t)(ndigits - 1) > SIZE_MAX / (size_t)PyLong_SHIFT) goto Overflow; result = (size_t)(ndigits - 1) * (size_t)PyLong_SHIFT; do { diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c index c201da1..54d68b7 100644 --- a/Objects/obmalloc.c +++ b/Objects/obmalloc.c @@ -1057,7 +1057,7 @@ new_arena(void) if (numarenas <= maxarenas) return NULL; /* overflow */ #if SIZEOF_SIZE_T <= SIZEOF_INT - if (numarenas > PY_SIZE_MAX / sizeof(*arenas)) + if (numarenas > SIZE_MAX / sizeof(*arenas)) return NULL; /* overflow */ #endif nbytes = numarenas * sizeof(*arenas); |