mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
replace PY_SIZE_MAX with SIZE_MAX
This commit is contained in:
parent
c75abff533
commit
2f8bfef158
12 changed files with 18 additions and 26 deletions
|
@ -1787,7 +1787,7 @@ element_ass_subscr(PyObject* self_, PyObject* item, PyObject* value)
|
|||
step = -step;
|
||||
}
|
||||
|
||||
assert((size_t)slicelen <= PY_SIZE_MAX / sizeof(PyObject *));
|
||||
assert((size_t)slicelen <= SIZE_MAX / sizeof(PyObject *));
|
||||
|
||||
/* recycle is a list that will contain all the children
|
||||
* scheduled for removal.
|
||||
|
|
|
@ -976,7 +976,7 @@ static PyType_Spec PyTclObject_Type_spec = {
|
|||
};
|
||||
|
||||
|
||||
#if PY_SIZE_MAX > INT_MAX
|
||||
#if SIZE_MAX > INT_MAX
|
||||
#define CHECK_STRING_LENGTH(s) do { \
|
||||
if (s != NULL && strlen(s) >= INT_MAX) { \
|
||||
PyErr_SetString(PyExc_OverflowError, "string is too long"); \
|
||||
|
|
|
@ -655,7 +655,7 @@ tracemalloc_add_trace(_PyTraceMalloc_domain_t domain, uintptr_t ptr,
|
|||
}
|
||||
}
|
||||
|
||||
assert(tracemalloc_traced_memory <= PY_SIZE_MAX - size);
|
||||
assert(tracemalloc_traced_memory <= SIZE_MAX - size);
|
||||
tracemalloc_traced_memory += size;
|
||||
if (tracemalloc_traced_memory > tracemalloc_peak_traced_memory)
|
||||
tracemalloc_peak_traced_memory = tracemalloc_traced_memory;
|
||||
|
@ -672,7 +672,7 @@ tracemalloc_alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize)
|
|||
PyMemAllocatorEx *alloc = (PyMemAllocatorEx *)ctx;
|
||||
void *ptr;
|
||||
|
||||
assert(elsize == 0 || nelem <= PY_SIZE_MAX / elsize);
|
||||
assert(elsize == 0 || nelem <= SIZE_MAX / elsize);
|
||||
|
||||
if (use_calloc)
|
||||
ptr = alloc->calloc(alloc->ctx, nelem, elsize);
|
||||
|
|
|
@ -1337,7 +1337,7 @@ audioop_ratecv_impl(PyObject *module, Py_buffer *fragment, int width,
|
|||
weightA /= d;
|
||||
weightB /= d;
|
||||
|
||||
if ((size_t)nchannels > PY_SIZE_MAX/sizeof(int)) {
|
||||
if ((size_t)nchannels > SIZE_MAX/sizeof(int)) {
|
||||
PyErr_SetString(PyExc_MemoryError,
|
||||
"not enough memory for output buffer");
|
||||
return NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue