Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Doc/c-api/init.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,7 @@ All of the following functions must be called after :c:func:`Py_Initialize`.
to :c:func:`PyThreadState_Clear`.


.. 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.
Expand Down
2 changes: 1 addition & 1 deletion Include/internal/pycore_pystate.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ struct _is {
PyObject *audit_hooks;
};

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 *);
Expand Down
12 changes: 6 additions & 6 deletions Modules/_randommodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,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;
Expand All @@ -244,14 +244,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));
}
Expand Down
8 changes: 4 additions & 4 deletions Modules/_sha3/sha3module.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,18 @@
#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
/* opt32 is used for the remaining 32 and 64bit platforms */
#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 unsigned char UINT8;
typedef uint64_t UINT64;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably we can remove these typedefs and restore the original ones?

#if NOT_PYTHON
typedef unsigned char UINT8;
/* typedef unsigned long long int UINT64; */
#endif

typedef uint8_t UINT8;
#endif

/* replacement for brg_endian.h */
Expand Down
2 changes: 1 addition & 1 deletion Modules/_xxsubinterpretersmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -2133,7 +2133,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);
}

Expand Down
2 changes: 1 addition & 1 deletion Objects/interpreteridobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,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;
}
Expand Down
4 changes: 2 additions & 2 deletions Objects/stringlib/codecs.h
Original file line number Diff line number Diff line change
Expand Up @@ -747,10 +747,10 @@ STRINGLIB(utf16_encode)(const STRINGLIB_CHAR *in,
Py_LOCAL_INLINE(Py_ssize_t)
STRINGLIB(utf32_encode)(const STRINGLIB_CHAR *in,
Py_ssize_t len,
PY_UINT32_T **outptr,
uint32_t **outptr,
int native_ordering)
{
PY_UINT32_T *out = *outptr;
uint32_t *out = *outptr;
const STRINGLIB_CHAR *end = in + len;
if (native_ordering) {
const STRINGLIB_CHAR *unrolled_end = in + _Py_SIZE_ROUND_DOWN(len, 4);
Expand Down
7 changes: 0 additions & 7 deletions PC/pyconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -347,13 +347,6 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */

#endif

/* define signed and unsigned exact-width 32-bit and 64-bit types, used in the
implementation of Python integers. */
#define PY_UINT32_T uint32_t
#define PY_UINT64_T uint64_t
#define PY_INT32_T int32_t
#define PY_INT64_T int64_t

/* Fairly standard from here! */

/* Define to 1 if you have the `copysign' function. */
Expand Down
6 changes: 3 additions & 3 deletions Python/pystate.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,11 +421,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;
}
Expand All @@ -438,7 +438,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) {
Expand Down