]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-40302: Replace PY_INT64_T with int64_t (GH-19573)
authorVictor Stinner <vstinner@python.org>
Fri, 17 Apr 2020 17:13:06 +0000 (19:13 +0200)
committerGitHub <noreply@github.com>
Fri, 17 Apr 2020 17:13:06 +0000 (19:13 +0200)
* Replace PY_INT64_T with int64_t
* Replace PY_UINT32_T with uint32_t
* Replace PY_UINT64_T with uint64_t

sha3module.c no longer checks if PY_UINT64_T is defined since it's
always defined and uint64_t is always available on platforms
supported by Python.

Doc/c-api/init.rst
Include/internal/pycore_interp.h
Modules/_randommodule.c
Modules/_sha3/sha3module.c
Modules/_xxsubinterpretersmodule.c
Objects/interpreteridobject.c
Python/pystate.c

index b5c647f9b1c62e772dac7c59fd4b5caba3d72ae3..435808f537b8822d2f696c8a80ee85f278872cdc 100644 (file)
@@ -1114,7 +1114,7 @@ All of the following functions must be called after :c:func:`Py_Initialize`.
    .. versionadded:: 3.9
 
 
-.. c:function:: PY_INT64_T PyInterpreterState_GetID(PyInterpreterState *interp)
+.. c:function:: int64_t PyInterpreterState_GetID(PyInterpreterState *interp)
 
    Return the interpreter's unique ID.  If there was any error in doing
    so then ``-1`` is returned and an error is set.
index c6fc6aff5ab2553fa28924c2eb99c6c477c59d76..6e9937caa9dbff1bd05dbe0ae8fae9589e93a866 100644 (file)
@@ -170,7 +170,7 @@ struct _xidregitem {
     struct _xidregitem *next;
 };
 
-PyAPI_FUNC(struct _is*) _PyInterpreterState_LookUpID(PY_INT64_T);
+PyAPI_FUNC(struct _is*) _PyInterpreterState_LookUpID(int64_t);
 
 PyAPI_FUNC(int) _PyInterpreterState_IDInitref(struct _is *);
 PyAPI_FUNC(void) _PyInterpreterState_IDIncref(struct _is *);
index 560460b9a44be2380f2c5107b8f705592e18e021..51c084288fc4bf4ccd9aa63986ba4058a03b8304 100644 (file)
@@ -234,7 +234,7 @@ init_by_array(RandomObject *self, uint32_t init_key[], size_t key_length)
 static int
 random_seed_urandom(RandomObject *self)
 {
-    PY_UINT32_T key[N];
+    uint32_t key[N];
 
     if (_PyOS_URandomNonblock(key, sizeof(key)) < 0) {
         return -1;
@@ -250,14 +250,14 @@ random_seed_time_pid(RandomObject *self)
     uint32_t key[5];
 
     now = _PyTime_GetSystemClock();
-    key[0] = (PY_UINT32_T)(now & 0xffffffffU);
-    key[1] = (PY_UINT32_T)(now >> 32);
+    key[0] = (uint32_t)(now & 0xffffffffU);
+    key[1] = (uint32_t)(now >> 32);
 
-    key[2] = (PY_UINT32_T)getpid();
+    key[2] = (uint32_t)getpid();
 
     now = _PyTime_GetMonotonicClock();
-    key[3] = (PY_UINT32_T)(now & 0xffffffffU);
-    key[4] = (PY_UINT32_T)(now >> 32);
+    key[3] = (uint32_t)(now & 0xffffffffU);
+    key[4] = (uint32_t)(now >> 32);
 
     init_by_array(self, key, Py_ARRAY_LENGTH(key));
 }
index 9cdee5869a2716cf399b0c23660c2687bddc0fd8..c826b42df13f92f7f026cc3b00230786d78147a5 100644 (file)
@@ -40,7 +40,7 @@
 #elif PY_BIG_ENDIAN
   /* opt64 is not yet supported on big endian platforms */
   #define KeccakOpt 32
-#elif SIZEOF_VOID_P == 8 && defined(PY_UINT64_T)
+#elif SIZEOF_VOID_P == 8
   /* opt64 works only on little-endian 64bit platforms with unsigned int64 */
   #define KeccakOpt 64
 #else
@@ -48,9 +48,9 @@
   #define KeccakOpt 32
 #endif
 
-#if KeccakOpt == 64 && defined(PY_UINT64_T)
+#if KeccakOpt == 64
   /* 64bit platforms with unsigned int64 */
-  typedef PY_UINT64_T UINT64;
+  typedef uint64_t UINT64;
   typedef unsigned char UINT8;
 #endif
 
index b3616ae1b76652f0fd7fee775ffd48761779abd7..fa35e14c5540129777744959fafef26eb72d664c 100644 (file)
@@ -2135,7 +2135,7 @@ static PyObject *
 interp_get_main(PyObject *self, PyObject *Py_UNUSED(ignored))
 {
     // Currently, 0 is always the main interpreter.
-    PY_INT64_T id = 0;
+    int64_t id = 0;
     return _PyInterpreterID_New(id);
 }
 
index a250293a4727755ecfa8b1839eed44c113f5930b..39bde97269590b610561bf2ef8489f925368d62e 100644 (file)
@@ -270,7 +270,7 @@ _PyInterpreterState_GetIDObject(PyInterpreterState *interp)
     if (_PyInterpreterState_IDInitref(interp) != 0) {
         return NULL;
     };
-    PY_INT64_T id = PyInterpreterState_GetID(interp);
+    int64_t id = PyInterpreterState_GetID(interp);
     if (id < 0) {
         return NULL;
     }
index 84a694b32e5d0f7e2730eb276d3cb90f498eef3b..d6f58822b64ae5796eeed6ccaa063dcca3ce2e78 100644 (file)
@@ -452,11 +452,11 @@ PyInterpreterState_GetID(PyInterpreterState *interp)
 
 
 static PyInterpreterState *
-interp_look_up_id(_PyRuntimeState *runtime, PY_INT64_T requested_id)
+interp_look_up_id(_PyRuntimeState *runtime, int64_t requested_id)
 {
     PyInterpreterState *interp = runtime->interpreters.head;
     while (interp != NULL) {
-        PY_INT64_T id = PyInterpreterState_GetID(interp);
+        int64_t id = PyInterpreterState_GetID(interp);
         if (id < 0) {
             return NULL;
         }
@@ -469,7 +469,7 @@ interp_look_up_id(_PyRuntimeState *runtime, PY_INT64_T requested_id)
 }
 
 PyInterpreterState *
-_PyInterpreterState_LookUpID(PY_INT64_T requested_id)
+_PyInterpreterState_LookUpID(int64_t requested_id)
 {
     PyInterpreterState *interp = NULL;
     if (requested_id >= 0) {