martin.v.loewis
2008-09-11 06:55:48 UTC
Author: martin.v.loewis
Date: Thu Sep 11 08:55:48 2008
New Revision: 66384
Log:
Merged revisions 66383 via svnmerge from
svn+ssh://pythondev at svn.python.org/python/trunk
........
r66383 | martin.v.loewis | 2008-09-11 08:53:30 +0200 (Do, 11 Sep 2008) | 3 lines
Issue #3642: Suppress warning in obmalloc when size_t is
larger than uint. Reverts r65975. Reviewed by Brett Cannon.
........
Modified:
python/branches/py3k/ (props changed)
python/branches/py3k/Objects/obmalloc.c
Modified: python/branches/py3k/Objects/obmalloc.c
==============================================================================
--- python/branches/py3k/Objects/obmalloc.c (original)
+++ python/branches/py3k/Objects/obmalloc.c Thu Sep 11 08:55:48 2008
@@ -517,7 +517,7 @@
#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 @@
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)
Date: Thu Sep 11 08:55:48 2008
New Revision: 66384
Log:
Merged revisions 66383 via svnmerge from
svn+ssh://pythondev at svn.python.org/python/trunk
........
r66383 | martin.v.loewis | 2008-09-11 08:53:30 +0200 (Do, 11 Sep 2008) | 3 lines
Issue #3642: Suppress warning in obmalloc when size_t is
larger than uint. Reverts r65975. Reviewed by Brett Cannon.
........
Modified:
python/branches/py3k/ (props changed)
python/branches/py3k/Objects/obmalloc.c
Modified: python/branches/py3k/Objects/obmalloc.c
==============================================================================
--- python/branches/py3k/Objects/obmalloc.c (original)
+++ python/branches/py3k/Objects/obmalloc.c Thu Sep 11 08:55:48 2008
@@ -517,7 +517,7 @@
#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 @@
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)