diff options
-rw-r--r-- | Include/pyport.h | 19 | ||||
-rw-r--r-- | Modules/posixmodule.c | 8 | ||||
-rw-r--r-- | Modules/socketmodule.c | 2 | ||||
-rwxr-xr-x | PC/msvcrtmodule.c | 2 | ||||
-rw-r--r-- | PC/pyconfig.h | 4 | ||||
-rw-r--r-- | Python/thread_nt.h | 4 |
6 files changed, 22 insertions, 17 deletions
diff --git a/Include/pyport.h b/Include/pyport.h index 176e21e..aa9c1f7 100644 --- a/Include/pyport.h +++ b/Include/pyport.h @@ -63,16 +63,25 @@ Used in: LONG_LONG /* uintptr_t is the C9X name for an unsigned integral type such that a * legitimate void* can be cast to uintptr_t and then back to void* again - * without loss of information. + * without loss of information. Similarly for intptr_t, wrt a signed + * integral type. */ #ifdef HAVE_UINTPTR_T -typedef uintptr_t Py_uintptr_t; +typedef uintptr_t Py_uintptr_t; +typedef intptr_t Py_intptr_t; + #elif SIZEOF_VOID_P <= SIZEOF_INT -typedef unsigned int Py_uintptr_t; +typedef unsigned int Py_uintptr_t; +typedef int Py_intptr_t; + #elif SIZEOF_VOID_P <= SIZEOF_LONG -typedef unsigned long Py_uintptr_t; +typedef unsigned long Py_uintptr_t; +typedef long Py_intptr_t; + #elif defined(HAVE_LONG_LONG) && (SIZEOF_VOID_P <= SIZEOF_LONG_LONG) -typedef unsigned LONG_LONG Py_uintptr_t; +typedef unsigned LONG_LONG Py_uintptr_t; +typedef LONG_LONG Py_intptr_t; + #else # error "Python needs a typedef for Py_uintptr_t in pyport.h." #endif /* HAVE_UINTPTR_T */ diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index c1ec84a..5f6f21d 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -1551,7 +1551,7 @@ posix_spawnv(PyObject *self, PyObject *args) PyObject *argv; char **argvlist; int mode, i, argc; - intptr_t spawnval; + Py_intptr_t spawnval; PyObject *(*getitem)(PyObject *, int); /* spawnv has three arguments: (mode, path, argv), where @@ -1620,7 +1620,7 @@ posix_spawnve(PyObject *self, PyObject *args) char **envlist; PyObject *key, *val, *keys=NULL, *vals=NULL, *res=NULL; int mode, i, pos, argc, envc; - intptr_t spawnval; + Py_intptr_t spawnval; PyObject *(*getitem)(PyObject *, int); /* spawnve has four arguments: (mode, path, argv, env), where @@ -3689,8 +3689,8 @@ posix_pipe(PyObject *self, PyObject *args) Py_END_ALLOW_THREADS if (!ok) return win32_error("CreatePipe", NULL); - read_fd = _open_osfhandle((intptr_t)read, 0); - write_fd = _open_osfhandle((intptr_t)write, 1); + read_fd = _open_osfhandle((Py_intptr_t)read, 0); + write_fd = _open_osfhandle((Py_intptr_t)write, 1); return Py_BuildValue("(ii)", read_fd, write_fd); #endif /* MS_WIN32 */ #endif diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 46ca35f..4ddaf9c 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -1423,7 +1423,7 @@ PySocketSock_makefile(PySocketSockObject *s, PyObject *args) char *mode = "r"; int bufsize = -1; #ifdef MS_WIN32 - intptr_t fd; + Py_intptr_t fd; #else int fd; #endif diff --git a/PC/msvcrtmodule.c b/PC/msvcrtmodule.c index 2714458..4584370 100755 --- a/PC/msvcrtmodule.c +++ b/PC/msvcrtmodule.c @@ -98,7 +98,7 @@ static PyObject * msvcrt_get_osfhandle(PyObject *self, PyObject *args) { int fd; - intptr_t handle; + Py_intptr_t handle; if (!PyArg_ParseTuple(args,"i:get_osfhandle", &fd)) return NULL; diff --git a/PC/pyconfig.h b/PC/pyconfig.h index 1e279ed..f287605 100644 --- a/PC/pyconfig.h +++ b/PC/pyconfig.h @@ -294,10 +294,6 @@ typedef int pid_t; #if _MSC_VER >= 1200 /* This file only exists in VC 6.0 or higher */ #include <basetsd.h> #endif -#if defined(MS_WINDOWS) && !defined(MS_WIN64) -typedef long intptr_t; -typedef unsigned long uintptr_t; -#endif #if defined(MS_WIN64) /* maintain "win32" sys.platform for backward compatibility of Python code, diff --git a/Python/thread_nt.h b/Python/thread_nt.h index f32304f..1d27627 100644 --- a/Python/thread_nt.h +++ b/Python/thread_nt.h @@ -152,7 +152,7 @@ static void PyThread__init_thread(void) */ int PyThread_start_new_thread(void (*func)(void *), void *arg) { - uintptr_t rv; + unsigned long rv; int success = 0; dprintf(("%ld: PyThread_start_new_thread called\n", PyThread_get_thread_ident())); @@ -161,7 +161,7 @@ int PyThread_start_new_thread(void (*func)(void *), void *arg) rv = _beginthread(func, 0, arg); /* use default stack size */ - if (rv != -1) { + if (rv != (unsigned long)-1) { success = 1; dprintf(("%ld: PyThread_start_new_thread succeeded: %p\n", PyThread_get_thread_ident(), rv)); } |