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 /Python | |
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 'Python')
-rw-r--r-- | Python/asdl.c | 8 | ||||
-rw-r--r-- | Python/ast.c | 2 | ||||
-rw-r--r-- | Python/compile.c | 4 |
3 files changed, 7 insertions, 7 deletions
diff --git a/Python/asdl.c b/Python/asdl.c index df387b2..c211078 100644 --- a/Python/asdl.c +++ b/Python/asdl.c @@ -9,14 +9,14 @@ _Py_asdl_seq_new(Py_ssize_t size, PyArena *arena) /* check size is sane */ if (size < 0 || - (size && (((size_t)size - 1) > (PY_SIZE_MAX / sizeof(void *))))) { + (size && (((size_t)size - 1) > (SIZE_MAX / sizeof(void *))))) { PyErr_NoMemory(); return NULL; } n = (size ? (sizeof(void *) * (size - 1)) : 0); /* check if size can be added safely */ - if (n > PY_SIZE_MAX - sizeof(asdl_seq)) { + if (n > SIZE_MAX - sizeof(asdl_seq)) { PyErr_NoMemory(); return NULL; } @@ -40,14 +40,14 @@ _Py_asdl_int_seq_new(Py_ssize_t size, PyArena *arena) /* check size is sane */ if (size < 0 || - (size && (((size_t)size - 1) > (PY_SIZE_MAX / sizeof(void *))))) { + (size && (((size_t)size - 1) > (SIZE_MAX / sizeof(void *))))) { PyErr_NoMemory(); return NULL; } n = (size ? (sizeof(void *) * (size - 1)) : 0); /* check if size can be added safely */ - if (n > PY_SIZE_MAX - sizeof(asdl_seq)) { + if (n > SIZE_MAX - sizeof(asdl_seq)) { PyErr_NoMemory(); return NULL; } diff --git a/Python/ast.c b/Python/ast.c index 0f9c193..c5f363b 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -3985,7 +3985,7 @@ decode_unicode_with_escapes(struct compiling *c, const char *s, size_t len) const char *end; /* check for integer overflow */ - if (len > PY_SIZE_MAX / 6) + if (len > SIZE_MAX / 6) return NULL; /* "ä" (2 bytes) may become "\U000000E4" (10 bytes), or 1:5 "\ä" (3 bytes) may become "\u005c\U000000E4" (16 bytes), or ~1:6 */ diff --git a/Python/compile.c b/Python/compile.c index 6fe5d5f..45e4262 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -804,7 +804,7 @@ compiler_next_instr(struct compiler *c, basicblock *b) oldsize = b->b_ialloc * sizeof(struct instr); newsize = oldsize << 1; - if (oldsize > (PY_SIZE_MAX >> 1)) { + if (oldsize > (SIZE_MAX >> 1)) { PyErr_NoMemory(); return -1; } @@ -4520,7 +4520,7 @@ assemble_init(struct assembler *a, int nblocks, int firstlineno) a->a_lnotab = PyBytes_FromStringAndSize(NULL, DEFAULT_LNOTAB_SIZE); if (!a->a_lnotab) return 0; - if ((size_t)nblocks > PY_SIZE_MAX / sizeof(basicblock *)) { + if ((size_t)nblocks > SIZE_MAX / sizeof(basicblock *)) { PyErr_NoMemory(); return 0; } |