1. Armin Rigo
  2. cpython-withatomic

Commits

Martin von Löwis  committed 3dc3180

Issue #3642: Suppress warning in obmalloc when size_t is
larger than uint. Reverts r65975. Reviewed by Brett Cannon.

  • Participants
  • Parent commits a4df490
  • Branches legacy-trunk

Comments (0)

Files changed (2)

File Misc/NEWS

View file
  • Ignore whitespace
 Core and Builtins
 -----------------
 
+- Issue #3642: Suppress warning in obmalloc when size_t is larger than uint.
+
 - Issue #3743: In a few places, PY_FORMAT_SIZE_T was incorrectly used with
   PyString_FromFormat or PyErr_Format to display size_t values. The macro
   PY_FORMAT_SIZE_T is designed to select the correct format for the OS
 
 - Fix problem using wrong name in decimal module reported by pychecker.
 
-- Issue #3642: Changed type of numarenas from uint to size_t
-  in order to silence a compilier warning on 64bit OSes.
-
 - Silenced another compiler warning about a used but not defined
   function 'stringlib_contains_obj'.
 

File Objects/obmalloc.c

View file
  • Ignore whitespace
 #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.
 		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)