@@ -8,6 +8,13 @@ extern "C" {
88# error "this header requires Py_BUILD_CORE define"
99#endif
1010
11+
12+ typedef unsigned int pymem_uint ; /* assuming >= 16 bits */
13+
14+ #undef uint
15+ #define uint pymem_uint
16+
17+
1118/* An object allocator for Python.
1219
1320 Here is an introduction to the layers of the Python memory architecture,
@@ -130,7 +137,7 @@ extern "C" {
130137#endif
131138
132139/* Return the number of bytes in size class I, as a uint. */
133- #define INDEX2SIZE (I ) (((uint )(I) + 1) << ALIGNMENT_SHIFT)
140+ #define INDEX2SIZE (I ) (((pymem_uint )(I) + 1) << ALIGNMENT_SHIFT)
134141
135142/*
136143 * Max size threshold below which malloc requests are considered to be
@@ -307,7 +314,7 @@ struct arena_object {
307314#define POOL_ADDR (P ) ((poolp)_Py_ALIGN_DOWN((P), POOL_SIZE))
308315
309316/* Return total number of blocks in pool of size index I, as a uint. */
310- #define NUMBLOCKS (I ) ((uint )(POOL_SIZE - POOL_OVERHEAD) / INDEX2SIZE(I))
317+ #define NUMBLOCKS (I ) ((pymem_uint )(POOL_SIZE - POOL_OVERHEAD) / INDEX2SIZE(I))
311318
312319/*==========================================================================*/
313320
@@ -657,6 +664,9 @@ struct _obmalloc_state {
657664};
658665
659666
667+ #undef uint
668+
669+
660670/* Allocate memory directly from the O/S virtual memory system,
661671 * where supported. Otherwise fallback on malloc */
662672void * _PyObject_VirtualAlloc (size_t size );
0 commit comments