]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #3642: Suppress warning in obmalloc when size_t is
authorMartin v. Löwis <martin@v.loewis.de>
Thu, 11 Sep 2008 06:53:30 +0000 (06:53 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Thu, 11 Sep 2008 06:53:30 +0000 (06:53 +0000)
larger than uint. Reverts r65975. Reviewed by Brett Cannon.

Misc/NEWS
Objects/obmalloc.c

index b9ec0e164922d9d95b71425db421e6418b66409d..55490b7f44a574cbdf7ef45bd461a1fc3bdf01a9 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,8 @@ What's New in Python 2.6 release candidate 1?
 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
@@ -52,9 +54,6 @@ Core and Builtins
 
 - 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'.
 
index b4ad60a86565b50a2780b6063f019ba5c597f31d..fc5ccf7abee2c6b7cca91abdef498613f1a2c600 100644 (file)
@@ -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)