mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
Issue #3642: Suppress warning in obmalloc when size_t is
larger than uint. Reverts r65975. Reviewed by Brett Cannon.
This commit is contained in:
parent
84076d8a11
commit
9fa5a2828c
2 changed files with 5 additions and 4 deletions
|
|
@ -517,7 +517,7 @@ new_arena(void)
|
|||
#endif
|
||||
if (unused_arena_objects == NULL) {
|
||||
uint i;
|
||||
size_t numarenas;
|
||||
uint numarenas;
|
||||
size_t nbytes;
|
||||
|
||||
/* Double the number of arena objects on each allocation.
|
||||
|
|
@ -526,8 +526,10 @@ new_arena(void)
|
|||
numarenas = maxarenas ? maxarenas << 1 : INITIAL_ARENA_OBJECTS;
|
||||
if (numarenas <= maxarenas)
|
||||
return NULL; /* overflow */
|
||||
#if SIZEOF_SIZE_T <= SIZEOF_INT
|
||||
if (numarenas > PY_SIZE_MAX / sizeof(*arenas))
|
||||
return NULL; /* overflow */
|
||||
#endif
|
||||
nbytes = numarenas * sizeof(*arenas);
|
||||
arenaobj = (struct arena_object *)realloc(arenas, nbytes);
|
||||
if (arenaobj == NULL)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue