diff --git a/Doc/api/utilities.tex b/Doc/api/utilities.tex index ab31f4e1df9..a0f7a44a717 100644 --- a/Doc/api/utilities.tex +++ b/Doc/api/utilities.tex @@ -496,7 +496,7 @@ whose address should be passed. \item[\samp{l} (integer) {[long int]}] Convert a Python integer to a C \ctype{long int}. - \item[\samp{L} (integer) {[LONG_LONG]}] + \item[\samp{L} (integer) {[PY_LONG_LONG]}] Convert a Python integer to a C \ctype{long long}. This format is only available on platforms that support \ctype{long long} (or \ctype{_int64} on Windows). diff --git a/Include/longobject.h b/Include/longobject.h index 1ac213cae43..63ca1135db4 100644 --- a/Include/longobject.h +++ b/Include/longobject.h @@ -33,10 +33,10 @@ PyAPI_FUNC(PyObject *) PyLong_FromVoidPtr(void *); PyAPI_FUNC(void *) PyLong_AsVoidPtr(PyObject *); #ifdef HAVE_LONG_LONG -PyAPI_FUNC(PyObject *) PyLong_FromLongLong(LONG_LONG); -PyAPI_FUNC(PyObject *) PyLong_FromUnsignedLongLong(unsigned LONG_LONG); -PyAPI_FUNC(LONG_LONG) PyLong_AsLongLong(PyObject *); -PyAPI_FUNC(unsigned LONG_LONG) PyLong_AsUnsignedLongLong(PyObject *); +PyAPI_FUNC(PyObject *) PyLong_FromLongLong(PY_LONG_LONG); +PyAPI_FUNC(PyObject *) PyLong_FromUnsignedLongLong(unsigned PY_LONG_LONG); +PyAPI_FUNC(PY_LONG_LONG) PyLong_AsLongLong(PyObject *); +PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLong(PyObject *); #endif /* HAVE_LONG_LONG */ PyAPI_FUNC(PyObject *) PyLong_FromString(char *, char **, int); diff --git a/Include/pyport.h b/Include/pyport.h index cc003a6d03c..b68a3b49602 100644 --- a/Include/pyport.h +++ b/Include/pyport.h @@ -27,7 +27,7 @@ Used in: Py_uintptr_t HAVE_LONG_LONG Meaning: The compiler supports the C type "long long" -Used in: LONG_LONG +Used in: PY_LONG_LONG **************************************************************************/ @@ -55,8 +55,8 @@ Used in: LONG_LONG */ #ifdef HAVE_LONG_LONG -#ifndef LONG_LONG -#define LONG_LONG long long +#ifndef PY_LONG_LONG +#define PY_LONG_LONG long long #endif #endif /* HAVE_LONG_LONG */ @@ -78,8 +78,8 @@ 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 LONG_LONG Py_intptr_t; +typedef unsigned PY_LONG_LONG Py_uintptr_t; +typedef PY_LONG_LONG Py_intptr_t; #else # error "Python needs a typedef for Py_uintptr_t in pyport.h." diff --git a/Misc/NEWS b/Misc/NEWS index 0a674d2cfb1..15a0dafa202 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -101,6 +101,8 @@ Build C API ----- +- LONG_LONG was renamed to PY_LONG_LONG. + - Added PyObject_SelfIter() to fill the tp_iter slot for the typical case where the method returns its self argument. diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index 4c3c2aa692c..c08dbb7e9b7 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -56,7 +56,7 @@ test_config(PyObject *self) CHECK_SIZEOF(SIZEOF_VOID_P, void*); CHECK_SIZEOF(SIZEOF_TIME_T, time_t); #ifdef HAVE_LONG_LONG - CHECK_SIZEOF(SIZEOF_LONG_LONG, LONG_LONG); + CHECK_SIZEOF(SIZEOF_LONG_LONG, PY_LONG_LONG); #endif #undef CHECK_SIZEOF @@ -172,7 +172,7 @@ test_dict_iteration(PyObject* self) Note that the meat of the test is contained in testcapi_long.h. This is revolting, but delicate code duplication is worse: "almost - exactly the same" code is needed to test LONG_LONG, but the ubiquitous + exactly the same" code is needed to test PY_LONG_LONG, but the ubiquitous dependence on type names makes it impossible to use a parameterized function. A giant macro would be even worse than this. A C++ template would be perfect. @@ -221,7 +221,7 @@ raise_test_longlong_error(const char* msg) } #define TESTNAME test_longlong_api_inner -#define TYPENAME LONG_LONG +#define TYPENAME PY_LONG_LONG #define F_S_TO_PY PyLong_FromLongLong #define F_PY_TO_S PyLong_AsLongLong #define F_U_TO_PY PyLong_FromUnsignedLongLong @@ -242,7 +242,7 @@ test_longlong_api(PyObject* self) #undef F_U_TO_PY #undef F_PY_TO_U -/* Test the L code for PyArg_ParseTuple. This should deliver a LONG_LONG +/* Test the L code for PyArg_ParseTuple. This should deliver a PY_LONG_LONG for both long and int arguments. The test may leak a little memory if it fails. */ @@ -250,7 +250,7 @@ static PyObject * test_L_code(PyObject *self) { PyObject *tuple, *num; - LONG_LONG value; + PY_LONG_LONG value; tuple = PyTuple_New(1); if (tuple == NULL) diff --git a/Modules/addrinfo.h b/Modules/addrinfo.h index 7f85d814a70..d781c0de578 100644 --- a/Modules/addrinfo.h +++ b/Modules/addrinfo.h @@ -142,7 +142,7 @@ struct addrinfo { */ #define _SS_MAXSIZE 128 #ifdef HAVE_LONG_LONG -#define _SS_ALIGNSIZE (sizeof(LONG_LONG)) +#define _SS_ALIGNSIZE (sizeof(PY_LONG_LONG)) #else #define _SS_ALIGNSIZE (sizeof(double)) #endif @@ -159,7 +159,7 @@ struct sockaddr_storage { #endif char __ss_pad1[_SS_PAD1SIZE]; #ifdef HAVE_LONG_LONG - LONG_LONG __ss_align; /* force desired structure storage alignment */ + PY_LONG_LONG __ss_align; /* force desired structure storage alignment */ #else double __ss_align; /* force desired structure storage alignment */ #endif diff --git a/Modules/bz2module.c b/Modules/bz2module.c index 114070fab10..5ab3f99d63a 100644 --- a/Modules/bz2module.c +++ b/Modules/bz2module.c @@ -36,7 +36,7 @@ static char __author__[] = (((long)bzs->total_out_hi32 << 32) + bzs->total_out_lo32) #elif SIZEOF_LONG_LONG >= 8 #define BZS_TOTAL_OUT(bzs) \ - (((LONG_LONG)bzs->total_out_hi32 << 32) + bzs->total_out_lo32) + (((PY_LONG_LONG)bzs->total_out_hi32 << 32) + bzs->total_out_lo32) #else #define BZS_TOTAL_OUT(bzs) \ bzs->total_out_lo32; @@ -1490,7 +1490,7 @@ BZ2Comp_compress(BZ2CompObject *self, PyObject *args) char *data; int datasize; int bufsize = SMALLCHUNK; - LONG_LONG totalout; + PY_LONG_LONG totalout; PyObject *ret = NULL; bz_stream *bzs = &self->bzs; int bzerror; @@ -1562,7 +1562,7 @@ BZ2Comp_flush(BZ2CompObject *self) int bufsize = SMALLCHUNK; PyObject *ret = NULL; bz_stream *bzs = &self->bzs; - LONG_LONG totalout; + PY_LONG_LONG totalout; int bzerror; ACQUIRE_LOCK(self); @@ -1768,7 +1768,7 @@ BZ2Decomp_decompress(BZ2DecompObject *self, PyObject *args) char *data; int datasize; int bufsize = SMALLCHUNK; - LONG_LONG totalout; + PY_LONG_LONG totalout; PyObject *ret = NULL; bz_stream *bzs = &self->bzs; int bzerror; diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index ab4992ec144..9bf52f3fabe 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -891,7 +891,7 @@ fill_time(PyObject *v, int index, time_t sec, unsigned long nsec) { PyObject *fval,*ival; #if SIZEOF_TIME_T > SIZEOF_LONG - ival = PyLong_FromLongLong((LONG_LONG)sec); + ival = PyLong_FromLongLong((PY_LONG_LONG)sec); #else ival = PyInt_FromLong((long)sec); #endif @@ -918,13 +918,13 @@ _pystat_fromstructstat(STRUCT_STAT st) PyStructSequence_SET_ITEM(v, 0, PyInt_FromLong((long)st.st_mode)); #ifdef HAVE_LARGEFILE_SUPPORT PyStructSequence_SET_ITEM(v, 1, - PyLong_FromLongLong((LONG_LONG)st.st_ino)); + PyLong_FromLongLong((PY_LONG_LONG)st.st_ino)); #else PyStructSequence_SET_ITEM(v, 1, PyInt_FromLong((long)st.st_ino)); #endif #if defined(HAVE_LONG_LONG) && !defined(MS_WINDOWS) PyStructSequence_SET_ITEM(v, 2, - PyLong_FromLongLong((LONG_LONG)st.st_dev)); + PyLong_FromLongLong((PY_LONG_LONG)st.st_dev)); #else PyStructSequence_SET_ITEM(v, 2, PyInt_FromLong((long)st.st_dev)); #endif @@ -933,7 +933,7 @@ _pystat_fromstructstat(STRUCT_STAT st) PyStructSequence_SET_ITEM(v, 5, PyInt_FromLong((long)st.st_gid)); #ifdef HAVE_LARGEFILE_SUPPORT PyStructSequence_SET_ITEM(v, 6, - PyLong_FromLongLong((LONG_LONG)st.st_size)); + PyLong_FromLongLong((PY_LONG_LONG)st.st_size)); #else PyStructSequence_SET_ITEM(v, 6, PyInt_FromLong(st.st_size)); #endif @@ -2376,7 +2376,7 @@ posix_spawnv(PyObject *self, PyObject *args) #if SIZEOF_LONG == SIZEOF_VOID_P return Py_BuildValue("l", (long) spawnval); #else - return Py_BuildValue("L", (LONG_LONG) spawnval); + return Py_BuildValue("L", (PY_LONG_LONG) spawnval); #endif } @@ -2517,7 +2517,7 @@ posix_spawnve(PyObject *self, PyObject *args) #if SIZEOF_LONG == SIZEOF_VOID_P res = Py_BuildValue("l", (long) spawnval); #else - res = Py_BuildValue("L", (LONG_LONG) spawnval); + res = Py_BuildValue("L", (PY_LONG_LONG) spawnval); #endif fail_2: @@ -5084,7 +5084,7 @@ posix_lseek(PyObject *self, PyObject *args) { int fd, how; #if defined(MS_WIN64) || defined(MS_WINDOWS) - LONG_LONG pos, res; + PY_LONG_LONG pos, res; #else off_t pos, res; #endif @@ -5816,17 +5816,17 @@ _pystatvfs_fromstructstatvfs(struct statvfs st) { PyStructSequence_SET_ITEM(v, 0, PyInt_FromLong((long) st.f_bsize)); PyStructSequence_SET_ITEM(v, 1, PyInt_FromLong((long) st.f_frsize)); PyStructSequence_SET_ITEM(v, 2, - PyLong_FromLongLong((LONG_LONG) st.f_blocks)); + PyLong_FromLongLong((PY_LONG_LONG) st.f_blocks)); PyStructSequence_SET_ITEM(v, 3, - PyLong_FromLongLong((LONG_LONG) st.f_bfree)); + PyLong_FromLongLong((PY_LONG_LONG) st.f_bfree)); PyStructSequence_SET_ITEM(v, 4, - PyLong_FromLongLong((LONG_LONG) st.f_bavail)); + PyLong_FromLongLong((PY_LONG_LONG) st.f_bavail)); PyStructSequence_SET_ITEM(v, 5, - PyLong_FromLongLong((LONG_LONG) st.f_files)); + PyLong_FromLongLong((PY_LONG_LONG) st.f_files)); PyStructSequence_SET_ITEM(v, 6, - PyLong_FromLongLong((LONG_LONG) st.f_ffree)); + PyLong_FromLongLong((PY_LONG_LONG) st.f_ffree)); PyStructSequence_SET_ITEM(v, 7, - PyLong_FromLongLong((LONG_LONG) st.f_favail)); + PyLong_FromLongLong((PY_LONG_LONG) st.f_favail)); PyStructSequence_SET_ITEM(v, 8, PyInt_FromLong((long) st.f_flag)); PyStructSequence_SET_ITEM(v, 9, PyInt_FromLong((long) st.f_namemax)); #endif diff --git a/Modules/resource.c b/Modules/resource.c index 8653f038802..003599d7420 100644 --- a/Modules/resource.c +++ b/Modules/resource.c @@ -128,8 +128,8 @@ resource_getrlimit(PyObject *self, PyObject *args) #if defined(HAVE_LONG_LONG) if (sizeof(rl.rlim_cur) > sizeof(long)) { return Py_BuildValue("LL", - (LONG_LONG) rl.rlim_cur, - (LONG_LONG) rl.rlim_max); + (PY_LONG_LONG) rl.rlim_cur, + (PY_LONG_LONG) rl.rlim_max); } #endif return Py_BuildValue("ll", (long) rl.rlim_cur, (long) rl.rlim_max); @@ -292,7 +292,7 @@ initresource(void) #if defined(HAVE_LONG_LONG) if (sizeof(RLIM_INFINITY) > sizeof(long)) { - v = PyLong_FromLongLong((LONG_LONG) RLIM_INFINITY); + v = PyLong_FromLongLong((PY_LONG_LONG) RLIM_INFINITY); } else #endif { diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 2b8e3ea51f8..9d8d6140d80 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -1437,7 +1437,7 @@ sock_fileno(PySocketSockObject *s) #if SIZEOF_SOCKET_T <= SIZEOF_LONG return PyInt_FromLong((long) s->sock_fd); #else - return PyLong_FromLongLong((LONG_LONG)s->sock_fd); + return PyLong_FromLongLong((PY_LONG_LONG)s->sock_fd); #endif } diff --git a/Modules/structmodule.c b/Modules/structmodule.c index e4e1eb57809..22f1c549772 100644 --- a/Modules/structmodule.c +++ b/Modules/structmodule.c @@ -68,8 +68,8 @@ typedef struct { char c; void *x; } st_void_p; /* We can't support q and Q in native mode unless the compiler does; in std mode, they're 8 bytes on all platforms. */ #ifdef HAVE_LONG_LONG -typedef struct { char c; LONG_LONG x; } s_long_long; -#define LONG_LONG_ALIGN (sizeof(s_long_long) - sizeof(LONG_LONG)) +typedef struct { char c; PY_LONG_LONG x; } s_long_long; +#define LONG_LONG_ALIGN (sizeof(s_long_long) - sizeof(PY_LONG_LONG)) #endif #define STRINGIFY(x) #x @@ -146,9 +146,9 @@ get_ulong(PyObject *v, unsigned long *p) /* Same, but handling native long long. */ static int -get_longlong(PyObject *v, LONG_LONG *p) +get_longlong(PyObject *v, PY_LONG_LONG *p) { - LONG_LONG x; + PY_LONG_LONG x; v = get_pylong(v); if (v == NULL) @@ -156,7 +156,7 @@ get_longlong(PyObject *v, LONG_LONG *p) assert(PyLong_Check(v)); x = PyLong_AsLongLong(v); Py_DECREF(v); - if (x == (LONG_LONG)-1 && PyErr_Occurred()) + if (x == (PY_LONG_LONG)-1 && PyErr_Occurred()) return -1; *p = x; return 0; @@ -165,9 +165,9 @@ get_longlong(PyObject *v, LONG_LONG *p) /* Same, but handling native unsigned long long. */ static int -get_ulonglong(PyObject *v, unsigned LONG_LONG *p) +get_ulonglong(PyObject *v, unsigned PY_LONG_LONG *p) { - unsigned LONG_LONG x; + unsigned PY_LONG_LONG x; v = get_pylong(v); if (v == NULL) @@ -175,7 +175,7 @@ get_ulonglong(PyObject *v, unsigned LONG_LONG *p) assert(PyLong_Check(v)); x = PyLong_AsUnsignedLongLong(v); Py_DECREF(v); - if (x == (unsigned LONG_LONG)-1 && PyErr_Occurred()) + if (x == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred()) return -1; *p = x; return 0; @@ -315,7 +315,7 @@ nu_ulong(const char *p, const formatdef *f) static PyObject * nu_longlong(const char *p, const formatdef *f) { - LONG_LONG x; + PY_LONG_LONG x; memcpy((char *)&x, p, sizeof x); return PyLong_FromLongLong(x); } @@ -323,7 +323,7 @@ nu_longlong(const char *p, const formatdef *f) static PyObject * nu_ulonglong(const char *p, const formatdef *f) { - unsigned LONG_LONG x; + unsigned PY_LONG_LONG x; memcpy((char *)&x, p, sizeof x); return PyLong_FromUnsignedLongLong(x); } @@ -480,7 +480,7 @@ np_ulong(char *p, PyObject *v, const formatdef *f) static int np_longlong(char *p, PyObject *v, const formatdef *f) { - LONG_LONG x; + PY_LONG_LONG x; if (get_longlong(v, &x) < 0) return -1; memcpy(p, (char *)&x, sizeof x); @@ -490,7 +490,7 @@ np_longlong(char *p, PyObject *v, const formatdef *f) static int np_ulonglong(char *p, PyObject *v, const formatdef *f) { - unsigned LONG_LONG x; + unsigned PY_LONG_LONG x; if (get_ulonglong(v, &x) < 0) return -1; memcpy(p, (char *)&x, sizeof x); @@ -556,8 +556,8 @@ static formatdef native_table[] = { {'d', sizeof(double), DOUBLE_ALIGN, nu_double, np_double}, {'P', sizeof(void *), VOID_P_ALIGN, nu_void_p, np_void_p}, #ifdef HAVE_LONG_LONG - {'q', sizeof(LONG_LONG), LONG_LONG_ALIGN, nu_longlong, np_longlong}, - {'Q', sizeof(LONG_LONG), LONG_LONG_ALIGN, nu_ulonglong,np_ulonglong}, + {'q', sizeof(PY_LONG_LONG), LONG_LONG_ALIGN, nu_longlong, np_longlong}, + {'Q', sizeof(PY_LONG_LONG), LONG_LONG_ALIGN, nu_ulonglong,np_ulonglong}, #endif {0} }; diff --git a/Objects/longobject.c b/Objects/longobject.c index 446affb54d5..e02bce46108 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -641,12 +641,12 @@ PyLong_FromVoidPtr(void *p) # error "PyLong_FromVoidPtr: sizeof(void*) > sizeof(long), but no long long" #endif #if SIZEOF_LONG_LONG < SIZEOF_VOID_P -# error "PyLong_FromVoidPtr: sizeof(LONG_LONG) < sizeof(void*)" +# error "PyLong_FromVoidPtr: sizeof(PY_LONG_LONG) < sizeof(void*)" #endif /* optimize null pointers */ if (p == NULL) return PyInt_FromLong(0); - return PyLong_FromLongLong((LONG_LONG)p); + return PyLong_FromLongLong((PY_LONG_LONG)p); #endif /* SIZEOF_VOID_P <= SIZEOF_LONG */ } @@ -673,9 +673,9 @@ PyLong_AsVoidPtr(PyObject *vv) # error "PyLong_AsVoidPtr: sizeof(void*) > sizeof(long), but no long long" #endif #if SIZEOF_LONG_LONG < SIZEOF_VOID_P -# error "PyLong_AsVoidPtr: sizeof(LONG_LONG) < sizeof(void*)" +# error "PyLong_AsVoidPtr: sizeof(PY_LONG_LONG) < sizeof(void*)" #endif - LONG_LONG x; + PY_LONG_LONG x; if (PyInt_Check(vv)) x = PyInt_AS_LONG(vv); @@ -691,43 +691,43 @@ PyLong_AsVoidPtr(PyObject *vv) #ifdef HAVE_LONG_LONG -/* Initial LONG_LONG support by Chris Herborth (chrish@qnx.com), later +/* Initial PY_LONG_LONG support by Chris Herborth (chrish@qnx.com), later * rewritten to use the newer PyLong_{As,From}ByteArray API. */ #define IS_LITTLE_ENDIAN (int)*(unsigned char*)&one -/* Create a new long int object from a C LONG_LONG int. */ +/* Create a new long int object from a C PY_LONG_LONG int. */ PyObject * -PyLong_FromLongLong(LONG_LONG ival) +PyLong_FromLongLong(PY_LONG_LONG ival) { - LONG_LONG bytes = ival; + PY_LONG_LONG bytes = ival; int one = 1; return _PyLong_FromByteArray( (unsigned char *)&bytes, SIZEOF_LONG_LONG, IS_LITTLE_ENDIAN, 1); } -/* Create a new long int object from a C unsigned LONG_LONG int. */ +/* Create a new long int object from a C unsigned PY_LONG_LONG int. */ PyObject * -PyLong_FromUnsignedLongLong(unsigned LONG_LONG ival) +PyLong_FromUnsignedLongLong(unsigned PY_LONG_LONG ival) { - unsigned LONG_LONG bytes = ival; + unsigned PY_LONG_LONG bytes = ival; int one = 1; return _PyLong_FromByteArray( (unsigned char *)&bytes, SIZEOF_LONG_LONG, IS_LITTLE_ENDIAN, 0); } -/* Get a C LONG_LONG int from a long int object. +/* Get a C PY_LONG_LONG int from a long int object. Return -1 and set an error if overflow occurs. */ -LONG_LONG +PY_LONG_LONG PyLong_AsLongLong(PyObject *vv) { - LONG_LONG bytes; + PY_LONG_LONG bytes; int one = 1; int res; @@ -737,7 +737,7 @@ PyLong_AsLongLong(PyObject *vv) } if (!PyLong_Check(vv)) { if (PyInt_Check(vv)) - return (LONG_LONG)PyInt_AsLong(vv); + return (PY_LONG_LONG)PyInt_AsLong(vv); PyErr_BadInternalCall(); return -1; } @@ -746,20 +746,20 @@ PyLong_AsLongLong(PyObject *vv) (PyLongObject *)vv, (unsigned char *)&bytes, SIZEOF_LONG_LONG, IS_LITTLE_ENDIAN, 1); - /* Plan 9 can't handle LONG_LONG in ? : expressions */ + /* Plan 9 can't handle PY_LONG_LONG in ? : expressions */ if (res < 0) - return (LONG_LONG)-1; + return (PY_LONG_LONG)-1; else return bytes; } -/* Get a C unsigned LONG_LONG int from a long int object. +/* Get a C unsigned PY_LONG_LONG int from a long int object. Return -1 and set an error if overflow occurs. */ -unsigned LONG_LONG +unsigned PY_LONG_LONG PyLong_AsUnsignedLongLong(PyObject *vv) { - unsigned LONG_LONG bytes; + unsigned PY_LONG_LONG bytes; int one = 1; int res; @@ -772,9 +772,9 @@ PyLong_AsUnsignedLongLong(PyObject *vv) (PyLongObject *)vv, (unsigned char *)&bytes, SIZEOF_LONG_LONG, IS_LITTLE_ENDIAN, 0); - /* Plan 9 can't handle LONG_LONG in ? : expressions */ + /* Plan 9 can't handle PY_LONG_LONG in ? : expressions */ if (res < 0) - return (unsigned LONG_LONG)res; + return (unsigned PY_LONG_LONG)res; else return bytes; } diff --git a/PC/pyconfig.h b/PC/pyconfig.h index 0e7912eb947..56538018ed6 100644 --- a/PC/pyconfig.h +++ b/PC/pyconfig.h @@ -167,7 +167,7 @@ typedef int pid_t; #define COMPILER "[gcc]" #define hypot _hypot -#define LONG_LONG long long +#define PY_LONG_LONG long long #endif /* GNUC */ /* ------------------------------------------------------------------------*/ @@ -191,8 +191,8 @@ typedef int pid_t; /* 64 bit ints are usually spelt __int64 unless compiler has overridden */ #define HAVE_LONG_LONG 1 -#ifndef LONG_LONG -# define LONG_LONG __int64 +#ifndef PY_LONG_LONG +# define PY_LONG_LONG __int64 #endif /* For Windows the Python core is in a DLL by default. Test @@ -237,7 +237,7 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */ # define SIZEOF_FPOS_T 8 # define SIZEOF_HKEY 8 /* configure.in defines HAVE_LARGEFILE_SUPPORT iff HAVE_LONG_LONG, - sizeof(off_t) > sizeof(long), and sizeof(LONG_LONG) >= sizeof(off_t). + sizeof(off_t) > sizeof(long), and sizeof(PY_LONG_LONG) >= sizeof(off_t). On Win64 the second condition is not true, but if fpos_t replaces off_t then this is true. The uses of HAVE_LARGEFILE_SUPPORT imply that Win64 should define this. */ diff --git a/Python/getargs.c b/Python/getargs.c index 02897f34a0f..1f37e41d837 100644 --- a/Python/getargs.c +++ b/Python/getargs.c @@ -550,10 +550,10 @@ convertsimple(PyObject *arg, char **p_format, va_list *p_va, char *msgbuf, } #ifdef HAVE_LONG_LONG - case 'L': {/* LONG_LONG */ - LONG_LONG *p = va_arg( *p_va, LONG_LONG * ); - LONG_LONG ival = PyLong_AsLongLong( arg ); - if( ival == (LONG_LONG)-1 && PyErr_Occurred() ) { + case 'L': {/* PY_LONG_LONG */ + PY_LONG_LONG *p = va_arg( *p_va, PY_LONG_LONG * ); + PY_LONG_LONG ival = PyLong_AsLongLong( arg ); + if( ival == (PY_LONG_LONG)-1 && PyErr_Occurred() ) { return converterr("long", arg, msgbuf, bufsize); } else { *p = ival; @@ -1320,9 +1320,9 @@ skipitem(char **p_format, va_list *p_va) } #ifdef HAVE_LONG_LONG - case 'L': /* LONG_LONG int */ + case 'L': /* PY_LONG_LONG int */ { - (void) va_arg(*p_va, LONG_LONG *); + (void) va_arg(*p_va, PY_LONG_LONG *); break; } #endif diff --git a/Python/modsupport.c b/Python/modsupport.c index 41e0c82ea3f..9725a1bd020 100644 --- a/Python/modsupport.c +++ b/Python/modsupport.c @@ -291,7 +291,7 @@ do_mkvalue(char **p_format, va_list *p_va) #ifdef HAVE_LONG_LONG case 'L': - return PyLong_FromLongLong((LONG_LONG)va_arg(*p_va, LONG_LONG)); + return PyLong_FromLongLong((PY_LONG_LONG)va_arg(*p_va, PY_LONG_LONG)); #endif #ifdef Py_USING_UNICODE case 'u':