replace Py_(u)intptr_t with the c99 standard types
authorBenjamin Peterson <benjamin@python.org>
Tue, 6 Sep 2016 20:47:26 +0000 (13:47 -0700)
committerBenjamin Peterson <benjamin@python.org>
Tue, 6 Sep 2016 20:47:26 +0000 (13:47 -0700)
21 files changed:
Include/pyatomic.h
Include/pymacro.h
Include/pymem.h
Modules/_elementtree.c
Modules/_sre.c
Modules/_testcapimodule.c
Modules/_tracemalloc.c
Modules/faulthandler.c
Modules/posixmodule.c
Modules/selectmodule.c
Modules/signalmodule.c
Modules/sre_lib.h
Objects/descrobject.c
Objects/longobject.c
Objects/obmalloc.c
PC/msvcrtmodule.c
Parser/grammar.c
Parser/parsetok.c
Python/ceval_gil.h
Python/compile.c
Python/pystate.c

index 89028ef378e23edfa3a73e896301e0de95e7fefb..893d30d2eb065217d19924e369a3e343d1b13dd2 100644 (file)
@@ -61,7 +61,7 @@ typedef enum _Py_memory_order {
 } _Py_memory_order;
 
 typedef struct _Py_atomic_address {
-    Py_uintptr_t _value;
+    uintptr_t _value;
 } _Py_atomic_address;
 
 typedef struct _Py_atomic_int {
@@ -98,7 +98,7 @@ typedef enum _Py_memory_order {
 } _Py_memory_order;
 
 typedef struct _Py_atomic_address {
-    Py_uintptr_t _value;
+    uintptr_t _value;
 } _Py_atomic_address;
 
 typedef struct _Py_atomic_int {
index 49929e5083e92885d1239bdc218ae65633d6398f..d1345c499b29b1814ba4cc5bd95372e644c1e149 100644 (file)
 #define _Py_SIZE_ROUND_UP(n, a) (((size_t)(n) + \
         (size_t)((a) - 1)) & ~(size_t)((a) - 1))
 /* Round pointer "p" down to the closest "a"-aligned address <= "p". */
-#define _Py_ALIGN_DOWN(p, a) ((void *)((Py_uintptr_t)(p) & ~(Py_uintptr_t)((a) - 1)))
+#define _Py_ALIGN_DOWN(p, a) ((void *)((uintptr_t)(p) & ~(uintptr_t)((a) - 1)))
 /* Round pointer "p" up to the closest "a"-aligned address >= "p". */
-#define _Py_ALIGN_UP(p, a) ((void *)(((Py_uintptr_t)(p) + \
-        (Py_uintptr_t)((a) - 1)) & ~(Py_uintptr_t)((a) - 1)))
+#define _Py_ALIGN_UP(p, a) ((void *)(((uintptr_t)(p) + \
+        (uintptr_t)((a) - 1)) & ~(uintptr_t)((a) - 1)))
 /* Check if pointer "p" is aligned to "a"-bytes boundary. */
-#define _Py_IS_ALIGNED(p, a) (!((Py_uintptr_t)(p) & (Py_uintptr_t)((a) - 1)))
+#define _Py_IS_ALIGNED(p, a) (!((uintptr_t)(p) & (uintptr_t)((a) - 1)))
 
 #ifdef __GNUC__
 #define Py_UNUSED(name) _unused_ ## name __attribute__((unused))
index 431e5b6d0f41381be7d55852ef74057518d06370..ce63bf83f842f5f75b49a473d557284c3ea77d60 100644 (file)
@@ -37,7 +37,7 @@ typedef unsigned int _PyTraceMalloc_domain_t;
    If memory block is already tracked, update the existing trace. */
 PyAPI_FUNC(int) _PyTraceMalloc_Track(
     _PyTraceMalloc_domain_t domain,
-    Py_uintptr_t ptr,
+    uintptr_t ptr,
     size_t size);
 
 /* Untrack an allocated memory block in the tracemalloc module.
@@ -46,7 +46,7 @@ PyAPI_FUNC(int) _PyTraceMalloc_Track(
    Return -2 if tracemalloc is disabled, otherwise return 0. */
 PyAPI_FUNC(int) _PyTraceMalloc_Untrack(
     _PyTraceMalloc_domain_t domain,
-    Py_uintptr_t ptr);
+    uintptr_t ptr);
 
 /* Get the traceback where a memory block was allocated.
 
@@ -58,7 +58,7 @@ PyAPI_FUNC(int) _PyTraceMalloc_Untrack(
    Raise an exception and return NULL on error. */
 PyAPI_FUNC(PyObject*) _PyTraceMalloc_GetTraceback(
     _PyTraceMalloc_domain_t domain,
-    Py_uintptr_t ptr);
+    uintptr_t ptr);
 #endif   /* !Py_LIMITED_API */
 
 
index 39eba7c8250de9d3e8a0e24e9ca6e90dc3935147..ca5ab2cbe2fc9199d35fa04ac971b8fc6e79671f 100644 (file)
@@ -57,9 +57,9 @@ do { memory -= size; printf("%8d - %s\n", memory, comment); } while (0)
    that all use of text and tail as object pointers must be wrapped in
    JOIN_OBJ.  see comments in the ElementObject definition for more
    info. */
-#define JOIN_GET(p) ((Py_uintptr_t) (p) & 1)
-#define JOIN_SET(p, flag) ((void*) ((Py_uintptr_t) (JOIN_OBJ(p)) | (flag)))
-#define JOIN_OBJ(p) ((PyObject*) ((Py_uintptr_t) (p) & ~(Py_uintptr_t)1))
+#define JOIN_GET(p) ((uintptr_t) (p) & 1)
+#define JOIN_SET(p, flag) ((void*) ((uintptr_t) (JOIN_OBJ(p)) | (flag)))
+#define JOIN_OBJ(p) ((PyObject*) ((uintptr_t) (p) & ~(uintptr_t)1))
 
 /* Py_CLEAR for a PyObject* that uses a join flag. Pass the pointer by
  * reference since this function sets it to NULL.
@@ -797,7 +797,7 @@ _elementtree_Element___deepcopy__(ElementObject *self, PyObject *memo)
     }
 
     /* add object to memo dictionary (so deepcopy won't visit it again) */
-    id = PyLong_FromSsize_t((Py_uintptr_t) self);
+    id = PyLong_FromSsize_t((uintptr_t) self);
     if (!id)
         goto error;
 
index 0a62f62dc65665050c545903b9718822884f88ee..afa90999ac6af1c840dad914c88e6623a008e2fe 100644 (file)
@@ -1582,7 +1582,7 @@ _sre_compile_impl(PyObject *module, PyObject *pattern, int flags,
         skip = *code;                                   \
         VTRACE(("%lu (skip to %p)\n",                   \
                (unsigned long)skip, code+skip));        \
-        if (skip-adj > (Py_uintptr_t)(end - code))      \
+        if (skip-adj > (uintptr_t)(end - code))      \
             FAIL;                                       \
         code++;                                         \
     } while (0)
@@ -1616,7 +1616,7 @@ _validate_charset(SRE_CODE *code, SRE_CODE *end)
 
         case SRE_OP_CHARSET:
             offset = 256/SRE_CODE_BITS; /* 256-bit bitmap */
-            if (offset > (Py_uintptr_t)(end - code))
+            if (offset > (uintptr_t)(end - code))
                 FAIL;
             code += offset;
             break;
@@ -1624,7 +1624,7 @@ _validate_charset(SRE_CODE *code, SRE_CODE *end)
         case SRE_OP_BIGCHARSET:
             GET_ARG; /* Number of blocks */
             offset = 256/sizeof(SRE_CODE); /* 256-byte table */
-            if (offset > (Py_uintptr_t)(end - code))
+            if (offset > (uintptr_t)(end - code))
                 FAIL;
             /* Make sure that each byte points to a valid block */
             for (i = 0; i < 256; i++) {
@@ -1633,7 +1633,7 @@ _validate_charset(SRE_CODE *code, SRE_CODE *end)
             }
             code += offset;
             offset = arg * (256/SRE_CODE_BITS); /* 256-bit bitmap times arg */
-            if (offset > (Py_uintptr_t)(end - code))
+            if (offset > (uintptr_t)(end - code))
                 FAIL;
             code += offset;
             break;
@@ -1784,11 +1784,11 @@ _validate_inner(SRE_CODE *code, SRE_CODE *end, Py_ssize_t groups)
                     GET_ARG; prefix_len = arg;
                     GET_ARG;
                     /* Here comes the prefix string */
-                    if (prefix_len > (Py_uintptr_t)(newcode - code))
+                    if (prefix_len > (uintptr_t)(newcode - code))
                         FAIL;
                     code += prefix_len;
                     /* And here comes the overlap table */
-                    if (prefix_len > (Py_uintptr_t)(newcode - code))
+                    if (prefix_len > (uintptr_t)(newcode - code))
                         FAIL;
                     /* Each overlap value should be < prefix_len */
                     for (i = 0; i < prefix_len; i++) {
@@ -1917,7 +1917,7 @@ _validate_inner(SRE_CODE *code, SRE_CODE *end, Py_ssize_t groups)
                to allow arbitrary jumps anywhere in the code; so we just look
                for a JUMP opcode preceding our skip target.
             */
-            if (skip >= 3 && skip-3 < (Py_uintptr_t)(end - code) &&
+            if (skip >= 3 && skip-3 < (uintptr_t)(end - code) &&
                 code[skip-3] == SRE_OP_JUMP)
             {
                 VTRACE(("both then and else parts present\n"));
index 8d2cf316939872301f4ac926c7c1aa10a8bb6f34..87cf4b271a6fd3ab7191fc73dd93182b6b3311df 100644 (file)
@@ -113,10 +113,10 @@ test_sizeof_c_types(PyObject *self)
     CHECK_SIZEOF(Py_ssize_t, sizeof(void *));
     CHECK_SIGNNESS(Py_ssize_t, 1);
 
-    CHECK_SIZEOF(Py_uintptr_t, sizeof(void *));
-    CHECK_SIGNNESS(Py_uintptr_t, 0);
-    CHECK_SIZEOF(Py_intptr_t, sizeof(void *));
-    CHECK_SIGNNESS(Py_intptr_t, 1);
+    CHECK_SIZEOF(uintptr_t, sizeof(void *));
+    CHECK_SIGNNESS(uintptr_t, 0);
+    CHECK_SIZEOF(intptr_t, sizeof(void *));
+    CHECK_SIGNNESS(intptr_t, 1);
 
     Py_INCREF(Py_None);
     return Py_None;
@@ -3861,11 +3861,11 @@ tracemalloc_track(PyObject *self, PyObject *args)
 
     if (release_gil) {
         Py_BEGIN_ALLOW_THREADS
-        res = _PyTraceMalloc_Track(domain, (Py_uintptr_t)ptr, size);
+        res = _PyTraceMalloc_Track(domain, (uintptr_t)ptr, size);
         Py_END_ALLOW_THREADS
     }
     else {
-        res = _PyTraceMalloc_Track(domain, (Py_uintptr_t)ptr, size);
+        res = _PyTraceMalloc_Track(domain, (uintptr_t)ptr, size);
     }
 
     if (res < 0) {
@@ -3890,7 +3890,7 @@ tracemalloc_untrack(PyObject *self, PyObject *args)
     if (PyErr_Occurred())
         return NULL;
 
-    res = _PyTraceMalloc_Untrack(domain, (Py_uintptr_t)ptr);
+    res = _PyTraceMalloc_Untrack(domain, (uintptr_t)ptr);
     if (res < 0) {
         PyErr_SetString(PyExc_RuntimeError, "_PyTraceMalloc_Track error");
         return NULL;
@@ -3912,7 +3912,7 @@ tracemalloc_get_traceback(PyObject *self, PyObject *args)
     if (PyErr_Occurred())
         return NULL;
 
-    return _PyTraceMalloc_GetTraceback(domain, (Py_uintptr_t)ptr);
+    return _PyTraceMalloc_GetTraceback(domain, (uintptr_t)ptr);
 }
 
 
index 48f5b47025705529eb886e73847db8c64064391d..1a53cfec252e476742897679de003a27040a6a7b 100644 (file)
@@ -67,7 +67,7 @@ typedef struct
 __attribute__((packed))
 #endif
 {
-    Py_uintptr_t ptr;
+    uintptr_t ptr;
     _PyTraceMalloc_domain_t domain;
 } pointer_t;
 
@@ -523,7 +523,7 @@ static int
 tracemalloc_use_domain_cb(_Py_hashtable_t *old_traces,
                            _Py_hashtable_entry_t *entry, void *user_data)
 {
-    Py_uintptr_t ptr;
+    uintptr_t ptr;
     pointer_t key;
     _Py_hashtable_t *new_traces = (_Py_hashtable_t *)user_data;
     const void *pdata = _Py_HASHTABLE_ENTRY_PDATA(old_traces, entry);
@@ -538,7 +538,7 @@ tracemalloc_use_domain_cb(_Py_hashtable_t *old_traces,
 }
 
 
-/* Convert tracemalloc_traces from compact key (Py_uintptr_t) to pointer_t key.
+/* Convert tracemalloc_traces from compact key (uintptr_t) to pointer_t key.
  * Return 0 on success, -1 on error. */
 static int
 tracemalloc_use_domain(void)
@@ -572,7 +572,7 @@ tracemalloc_use_domain(void)
 
 
 static void
-tracemalloc_remove_trace(_PyTraceMalloc_domain_t domain, Py_uintptr_t ptr)
+tracemalloc_remove_trace(_PyTraceMalloc_domain_t domain, uintptr_t ptr)
 {
     trace_t trace;
     int removed;
@@ -595,11 +595,11 @@ tracemalloc_remove_trace(_PyTraceMalloc_domain_t domain, Py_uintptr_t ptr)
 }
 
 #define REMOVE_TRACE(ptr) \
-            tracemalloc_remove_trace(DEFAULT_DOMAIN, (Py_uintptr_t)(ptr))
+            tracemalloc_remove_trace(DEFAULT_DOMAIN, (uintptr_t)(ptr))
 
 
 static int
-tracemalloc_add_trace(_PyTraceMalloc_domain_t domain, Py_uintptr_t ptr,
+tracemalloc_add_trace(_PyTraceMalloc_domain_t domain, uintptr_t ptr,
                       size_t size)
 {
     pointer_t key = {ptr, domain};
@@ -617,7 +617,7 @@ tracemalloc_add_trace(_PyTraceMalloc_domain_t domain, Py_uintptr_t ptr,
 
     if (!tracemalloc_config.use_domain && domain != DEFAULT_DOMAIN) {
         /* first trace using a non-zero domain whereas traces use compact
-           (Py_uintptr_t) keys: switch to pointer_t keys. */
+           (uintptr_t) keys: switch to pointer_t keys. */
         if (tracemalloc_use_domain() < 0) {
             return -1;
         }
@@ -663,7 +663,7 @@ tracemalloc_add_trace(_PyTraceMalloc_domain_t domain, Py_uintptr_t ptr,
 }
 
 #define ADD_TRACE(ptr, size) \
-            tracemalloc_add_trace(DEFAULT_DOMAIN, (Py_uintptr_t)(ptr), size)
+            tracemalloc_add_trace(DEFAULT_DOMAIN, (uintptr_t)(ptr), size)
 
 
 static void*
@@ -1023,7 +1023,7 @@ tracemalloc_init(void)
                                            hashtable_compare_pointer_t);
     }
     else {
-        tracemalloc_traces = hashtable_new(sizeof(Py_uintptr_t),
+        tracemalloc_traces = hashtable_new(sizeof(uintptr_t),
                                            sizeof(trace_t),
                                            _Py_hashtable_hash_ptr,
                                            _Py_hashtable_compare_direct);
@@ -1414,7 +1414,7 @@ finally:
 
 
 static traceback_t*
-tracemalloc_get_traceback(_PyTraceMalloc_domain_t domain, Py_uintptr_t ptr)
+tracemalloc_get_traceback(_PyTraceMalloc_domain_t domain, uintptr_t ptr)
 {
     trace_t trace;
     int found;
@@ -1461,7 +1461,7 @@ py_tracemalloc_get_object_traceback(PyObject *self, PyObject *obj)
     else
         ptr = (void *)obj;
 
-    traceback = tracemalloc_get_traceback(DEFAULT_DOMAIN, (Py_uintptr_t)ptr);
+    traceback = tracemalloc_get_traceback(DEFAULT_DOMAIN, (uintptr_t)ptr);
     if (traceback == NULL)
         Py_RETURN_NONE;
 
@@ -1489,7 +1489,7 @@ _PyMem_DumpTraceback(int fd, const void *ptr)
     traceback_t *traceback;
     int i;
 
-    traceback = tracemalloc_get_traceback(DEFAULT_DOMAIN, (Py_uintptr_t)ptr);
+    traceback = tracemalloc_get_traceback(DEFAULT_DOMAIN, (uintptr_t)ptr);
     if (traceback == NULL)
         return;
 
@@ -1762,7 +1762,7 @@ _PyTraceMalloc_Fini(void)
 }
 
 int
-_PyTraceMalloc_Track(_PyTraceMalloc_domain_t domain, Py_uintptr_t ptr,
+_PyTraceMalloc_Track(_PyTraceMalloc_domain_t domain, uintptr_t ptr,
                      size_t size)
 {
     int res;
@@ -1791,7 +1791,7 @@ _PyTraceMalloc_Track(_PyTraceMalloc_domain_t domain, Py_uintptr_t ptr,
 
 
 int
-_PyTraceMalloc_Untrack(_PyTraceMalloc_domain_t domain, Py_uintptr_t ptr)
+_PyTraceMalloc_Untrack(_PyTraceMalloc_domain_t domain, uintptr_t ptr)
 {
     if (!tracemalloc_config.tracing) {
         /* tracemalloc is not tracing: do nothing */
@@ -1807,7 +1807,7 @@ _PyTraceMalloc_Untrack(_PyTraceMalloc_domain_t domain, Py_uintptr_t ptr)
 
 
 PyObject*
-_PyTraceMalloc_GetTraceback(_PyTraceMalloc_domain_t domain, Py_uintptr_t ptr)
+_PyTraceMalloc_GetTraceback(_PyTraceMalloc_domain_t domain, uintptr_t ptr)
 {
     traceback_t *traceback;
 
index 8969b4ce5c2df9b5c55fe944496c1a71d091ccd1..c2d30008fc7724586340caa8aff5f3e44d928ca7 100644 (file)
@@ -1072,12 +1072,12 @@ faulthandler_fatal_error_py(PyObject *self, PyObject *args)
 #  pragma intel optimization_level 0
 #endif
 static
-Py_uintptr_t
-stack_overflow(Py_uintptr_t min_sp, Py_uintptr_t max_sp, size_t *depth)
+uintptr_t
+stack_overflow(uintptr_t min_sp, uintptr_t max_sp, size_t *depth)
 {
     /* allocate 4096 bytes on the stack at each call */
     unsigned char buffer[4096];
-    Py_uintptr_t sp = (Py_uintptr_t)&buffer;
+    uintptr_t sp = (uintptr_t)&buffer;
     *depth += 1;
     if (sp < min_sp || max_sp < sp)
         return sp;
@@ -1090,8 +1090,8 @@ static PyObject *
 faulthandler_stack_overflow(PyObject *self)
 {
     size_t depth, size;
-    Py_uintptr_t sp = (Py_uintptr_t)&depth;
-    Py_uintptr_t stop;
+    uintptr_t sp = (uintptr_t)&depth;
+    uintptr_t stop;
 
     faulthandler_suppress_crash_report();
     depth = 0;
index df295c25b66c7b1c56dbc53f9ea8a7a1250bf796..e88ee56fa01fc326264b88f75f6478d2cbeda372 100644 (file)
@@ -2492,8 +2492,8 @@ class id_t_converter(CConverter):
     type = 'id_t'
     format_unit = '" _Py_PARSE_PID "'
 
-class Py_intptr_t_converter(CConverter):
-    type = 'Py_intptr_t'
+class intptr_t_converter(CConverter):
+    type = 'intptr_t'
     format_unit = '" _Py_PARSE_INTPTR "'
 
 class Py_off_t_converter(CConverter):
@@ -5244,7 +5244,7 @@ os_spawnv_impl(PyObject *module, int mode, PyObject *path, PyObject *argv)
     char **argvlist;
     int i;
     Py_ssize_t argc;
-    Py_intptr_t spawnval;
+    intptr_t spawnval;
     PyObject *(*getitem)(PyObject *, Py_ssize_t);
 
     /* spawnv has three arguments: (mode, path, argv), where
@@ -5323,7 +5323,7 @@ os_spawnve_impl(PyObject *module, int mode, PyObject *path, PyObject *argv,
     char **envlist;
     PyObject *res = NULL;
     Py_ssize_t argc, i, envc;
-    Py_intptr_t spawnval;
+    intptr_t spawnval;
     PyObject *(*getitem)(PyObject *, Py_ssize_t);
     Py_ssize_t lastarg = 0;
 
@@ -7078,7 +7078,7 @@ os_waitpid_impl(PyObject *module, pid_t pid, int options)
 /* MS C has a variant of waitpid() that's usable for most purposes. */
 /*[clinic input]
 os.waitpid
-    pid: Py_intptr_t
+    pid: intptr_t
     options: int
     /
 
@@ -7091,11 +7091,11 @@ The options argument is ignored on Windows.
 [clinic start generated code]*/
 
 static PyObject *
-os_waitpid_impl(PyObject *module, Py_intptr_t pid, int options)
+os_waitpid_impl(PyObject *module, intptr_t pid, int options)
 /*[clinic end generated code: output=15f1ce005a346b09 input=444c8f51cca5b862]*/
 {
     int status;
-    Py_intptr_t res;
+    intptr_t res;
     int async_err = 0;
 
     do {
@@ -8559,8 +8559,8 @@ os_pipe_impl(PyObject *module)
     Py_BEGIN_ALLOW_THREADS
     ok = CreatePipe(&read, &write, &attr, 0);
     if (ok) {
-        fds[0] = _open_osfhandle((Py_intptr_t)read, _O_RDONLY);
-        fds[1] = _open_osfhandle((Py_intptr_t)write, _O_WRONLY);
+        fds[0] = _open_osfhandle((intptr_t)read, _O_RDONLY);
+        fds[1] = _open_osfhandle((intptr_t)write, _O_WRONLY);
         if (fds[0] == -1 || fds[1] == -1) {
             CloseHandle(read);
             CloseHandle(write);
@@ -11375,14 +11375,14 @@ os_set_inheritable_impl(PyObject *module, int fd, int inheritable)
 #ifdef MS_WINDOWS
 /*[clinic input]
 os.get_handle_inheritable -> bool
-    handle: Py_intptr_t
+    handle: intptr_t
     /
 
 Get the close-on-exe flag of the specified file descriptor.
 [clinic start generated code]*/
 
 static int
-os_get_handle_inheritable_impl(PyObject *module, Py_intptr_t handle)
+os_get_handle_inheritable_impl(PyObject *module, intptr_t handle)
 /*[clinic end generated code: output=9e5389b0aa0916ce input=5f7759443aae3dc5]*/
 {
     DWORD flags;
@@ -11398,7 +11398,7 @@ os_get_handle_inheritable_impl(PyObject *module, Py_intptr_t handle)
 
 /*[clinic input]
 os.set_handle_inheritable
-    handle: Py_intptr_t
+    handle: intptr_t
     inheritable: bool
     /
 
@@ -11406,7 +11406,7 @@ Set the inheritable flag of the specified handle.
 [clinic start generated code]*/
 
 static PyObject *
-os_set_handle_inheritable_impl(PyObject *module, Py_intptr_t handle,
+os_set_handle_inheritable_impl(PyObject *module, intptr_t handle,
                                int inheritable)
 /*[clinic end generated code: output=b1e67bfa3213d745 input=e64b2b2730469def]*/
 {
index 80e78734654eb71ac592e56e48fbf33b73addb84..49fa1f5268cca8273c952654e8d0c77c822a0ab0 100644 (file)
@@ -1797,7 +1797,7 @@ static PyTypeObject kqueue_queue_Type;
  */
 #if !defined(__OpenBSD__)
 #   define IDENT_TYPE  T_UINTPTRT
-#   define IDENT_CAST  Py_intptr_t
+#   define IDENT_CAST  intptr_t
 #   define DATA_TYPE   T_INTPTRT
 #   define DATA_FMT_UNIT INTPTRT_FMT_UNIT
 #   define IDENT_AsType PyLong_AsUintptr_t
@@ -1876,7 +1876,7 @@ static PyObject *
 kqueue_event_richcompare(kqueue_event_Object *s, kqueue_event_Object *o,
                          int op)
 {
-    Py_intptr_t result = 0;
+    intptr_t result = 0;
 
     if (!kqueue_event_Check(o)) {
         if (op == Py_EQ || op == Py_NE) {
index a1a18b062d1c9b86b69cdecc0d7b641485739830..e0780917c8757e5c610dd7524a2949d51090b3d2 100644 (file)
@@ -198,7 +198,7 @@ static int
 report_wakeup_write_error(void *data)
 {
     int save_errno = errno;
-    errno = (int) (Py_intptr_t) data;
+    errno = (int) (intptr_t) data;
     PyErr_SetFromErrno(PyExc_OSError);
     PySys_WriteStderr("Exception ignored when trying to write to the "
                       "signal wakeup fd:\n");
@@ -277,7 +277,7 @@ trip_signal(int sig_num)
 
             if (rc < 0) {
                 Py_AddPendingCall(report_wakeup_write_error,
-                                  (void *)(Py_intptr_t)errno);
+                                  (void *)(intptr_t)errno);
             }
         }
     }
index 78f7ac745ed18faad8e575e6b4a93c7f3bdec8d9..0865fc63a004d57daba2347470ca2f09d0f17d34 100644 (file)
@@ -529,7 +529,7 @@ entrance:
     if (ctx->pattern[0] == SRE_OP_INFO) {
         /* optimization info block */
         /* <INFO> <1=skip> <2=flags> <3=min> ... */
-        if (ctx->pattern[3] && (Py_uintptr_t)(end - ctx->ptr) < ctx->pattern[3]) {
+        if (ctx->pattern[3] && (uintptr_t)(end - ctx->ptr) < ctx->pattern[3]) {
             TRACE(("reject (got %" PY_FORMAT_SIZE_T "d chars, "
                    "need %" PY_FORMAT_SIZE_T "d)\n",
                    end - ctx->ptr, (Py_ssize_t) ctx->pattern[3]));
index 8b53ac2aeef18c5c5d879c70ee1cce2fdbd628fe..076e74148148254333f91eadb78417e296a3d682 100644 (file)
@@ -1019,7 +1019,7 @@ wrapper_dealloc(wrapperobject *wp)
 static PyObject *
 wrapper_richcompare(PyObject *a, PyObject *b, int op)
 {
-    Py_intptr_t result;
+    intptr_t result;
     PyObject *v;
     PyWrapperDescrObject *a_descr, *b_descr;
 
index e0be8b3c7b32ed64ae6cc5a1777f11ba8e72612b..6eb40e40df7257948db31975bb64c3ea9dce948a 100644 (file)
@@ -989,13 +989,13 @@ PyObject *
 PyLong_FromVoidPtr(void *p)
 {
 #if SIZEOF_VOID_P <= SIZEOF_LONG
-    return PyLong_FromUnsignedLong((unsigned long)(Py_uintptr_t)p);
+    return PyLong_FromUnsignedLong((unsigned long)(uintptr_t)p);
 #else
 
 #if SIZEOF_LONG_LONG < SIZEOF_VOID_P
 #   error "PyLong_FromVoidPtr: sizeof(long long) < sizeof(void*)"
 #endif
-    return PyLong_FromUnsignedLongLong((unsigned long long)(Py_uintptr_t)p);
+    return PyLong_FromUnsignedLongLong((unsigned long long)(uintptr_t)p);
 #endif /* SIZEOF_VOID_P <= SIZEOF_LONG */
 
 }
index 3f95133a74e5b81567f27196bf0fe2fb7f7b7350..c201da1a37cbfe21650ef3e61741aef41da0b7d8 100644 (file)
@@ -18,7 +18,7 @@ extern void _PyMem_DumpTraceback(int fd, const void *ptr);
 #define uint    unsigned int    /* assuming >= 16 bits */
 
 #undef uptr
-#define uptr    Py_uintptr_t
+#define uptr    uintptr_t
 
 /* Forward declaration */
 static void* _PyMem_DebugRawMalloc(void *ctx, size_t size);
index a6bd083827b7ecc7f46082bce8a5459ec40dd66d..7ab8f8f5103e5096041fb64111c551c24a98cea9 100644 (file)
 #endif
 
 /*[python input]
-class Py_intptr_t_converter(CConverter):
-    type = 'Py_intptr_t'
+class intptr_t_converter(CConverter):
+    type = 'intptr_t'
     format_unit = '"_Py_PARSE_INTPTR"'
 
 class handle_return_converter(long_return_converter):
-    type = 'Py_intptr_t'
+    type = 'intptr_t'
     cast = '(void *)'
     conversion_fn = 'PyLong_FromVoidPtr'
 
@@ -148,7 +148,7 @@ msvcrt_setmode_impl(PyObject *module, int fd, int flags)
 /*[clinic input]
 msvcrt.open_osfhandle -> long
 
-    handle: Py_intptr_t
+    handle: intptr_t
     flags: int
     /
 
@@ -160,7 +160,7 @@ to os.fdopen() to create a file object.
 [clinic start generated code]*/
 
 static long
-msvcrt_open_osfhandle_impl(PyObject *module, Py_intptr_t handle, int flags)
+msvcrt_open_osfhandle_impl(PyObject *module, intptr_t handle, int flags)
 /*[clinic end generated code: output=bf65e422243a39f9 input=4d8516ed32db8f65]*/
 {
     int fd;
@@ -183,11 +183,11 @@ Return the file handle for the file descriptor fd.
 Raises IOError if fd is not recognized.
 [clinic start generated code]*/
 
-static Py_intptr_t
+static intptr_t
 msvcrt_get_osfhandle_impl(PyObject *module, int fd)
 /*[clinic end generated code: output=eac47643338c0baa input=c7d18d02c8017ec1]*/
 {
-    Py_intptr_t handle = -1;
+    intptr_t handle = -1;
 
     if (!_PyVerify_fd(fd)) {
         PyErr_SetFromErrno(PyExc_IOError);
index e2cce28a8d6ae2b5c2be249785badc8a737d0998..84223c66a8018788d86a27053f4a2e889017505c 100644 (file)
@@ -63,7 +63,7 @@ addstate(dfa *d)
     s->s_upper = 0;
     s->s_accel = NULL;
     s->s_accept = 0;
-    return Py_SAFE_DOWNCAST(s - d->d_state, Py_intptr_t, int);
+    return Py_SAFE_DOWNCAST(s - d->d_state, intptr_t, int);
 }
 
 void
@@ -105,7 +105,7 @@ addlabel(labellist *ll, int type, const char *str)
     if (Py_DebugFlag)
         printf("Label @ %8p, %d: %s\n", ll, ll->ll_nlabels,
                PyGrammar_LabelRepr(lb));
-    return Py_SAFE_DOWNCAST(lb - ll->ll_label, Py_intptr_t, int);
+    return Py_SAFE_DOWNCAST(lb - ll->ll_label, intptr_t, int);
 }
 
 /* Same, but rather dies than adds */
index ebe9495184e2222cd443e6e2ed0b4972f1b1eb5a..1f467d63c41e24e10e908dd6003dc3f028cfd773 100644 (file)
@@ -255,7 +255,7 @@ parsetok(struct tok_state *tok, grammar *g, int start, perrdetail *err_ret,
 #endif
         if (a >= tok->line_start)
             col_offset = Py_SAFE_DOWNCAST(a - tok->line_start,
-                                          Py_intptr_t, int);
+                                          intptr_t, int);
         else
             col_offset = -1;
 
index 8d38ee9dfc8482ef34e107657aa3fbaa30510f68..a3b450bd5c4018c4af46c8f7b6914ce49875da09 100644 (file)
@@ -178,7 +178,7 @@ static void drop_gil(PyThreadState *tstate)
         /* Sub-interpreter support: threads might have been switched
            under our feet using PyThreadState_Swap(). Fix the GIL last
            holder variable so that our heuristics work. */
-        _Py_atomic_store_relaxed(&gil_last_holder, (Py_uintptr_t)tstate);
+        _Py_atomic_store_relaxed(&gil_last_holder, (uintptr_t)tstate);
     }
 
     MUTEX_LOCK(gil_mutex);
@@ -240,7 +240,7 @@ _ready:
     _Py_ANNOTATE_RWLOCK_ACQUIRED(&gil_locked, /*is_write=*/1);
 
     if (tstate != (PyThreadState*)_Py_atomic_load_relaxed(&gil_last_holder)) {
-        _Py_atomic_store_relaxed(&gil_last_holder, (Py_uintptr_t)tstate);
+        _Py_atomic_store_relaxed(&gil_last_holder, (uintptr_t)tstate);
         ++gil_switch_number;
     }
 
index b5629895c18d65b7f3a6eb05c39a76f86894b80c..6fe5d5fa829a0f5d6c4f8420f1cf9d563bb237d9 100644 (file)
@@ -476,9 +476,9 @@ compiler_unit_check(struct compiler_unit *u)
 {
     basicblock *block;
     for (block = u->u_blocks; block != NULL; block = block->b_list) {
-        assert((Py_uintptr_t)block != 0xcbcbcbcbU);
-        assert((Py_uintptr_t)block != 0xfbfbfbfbU);
-        assert((Py_uintptr_t)block != 0xdbdbdbdbU);
+        assert((uintptr_t)block != 0xcbcbcbcbU);
+        assert((uintptr_t)block != 0xfbfbfbfbU);
+        assert((uintptr_t)block != 0xdbdbdbdbU);
         if (block->b_instr != NULL) {
             assert(block->b_ialloc > 0);
             assert(block->b_iused > 0);
index 61bda2a9fbb08bf9f785818f34a95aadf09ce9bf..2ab5d5d611692caeeb58d9e25ac25e0907b62fe2 100644 (file)
@@ -6,7 +6,7 @@
 #define GET_TSTATE() \
     ((PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current))
 #define SET_TSTATE(value) \
-    _Py_atomic_store_relaxed(&_PyThreadState_Current, (Py_uintptr_t)(value))
+    _Py_atomic_store_relaxed(&_PyThreadState_Current, (uintptr_t)(value))
 #define GET_INTERP_STATE() \
     (GET_TSTATE()->interp)