replace Py_(u)intptr_t with the c99 standard types
This commit is contained in:
parent
3c397e4c39
commit
ca47063998
|
@ -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 {
|
||||
|
|
|
@ -79,12 +79,12 @@
|
|||
#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))
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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"));
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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]*/
|
||||
{
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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]));
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -33,12 +33,12 @@
|
|||
#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);
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue