diff options
author | Benjamin Peterson <benjamin@python.org> | 2016-09-06 00:44:18 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2016-09-06 00:44:18 (GMT) |
commit | ed4aa83ff77ff11059f64dab711adf35ce9d0e0f (patch) | |
tree | cf430f6a641782d7c794c1adc73c055a3f120a69 /Modules/_ctypes | |
parent | b3b0767861c69115a1482e3ade8d29207e204b15 (diff) | |
download | cpython-ed4aa83ff77ff11059f64dab711adf35ce9d0e0f.zip cpython-ed4aa83ff77ff11059f64dab711adf35ce9d0e0f.tar.gz cpython-ed4aa83ff77ff11059f64dab711adf35ce9d0e0f.tar.bz2 |
require a long long data type (closes #27961)
Diffstat (limited to 'Modules/_ctypes')
-rw-r--r-- | Modules/_ctypes/_ctypes_test.c | 3 | ||||
-rw-r--r-- | Modules/_ctypes/callproc.c | 4 | ||||
-rw-r--r-- | Modules/_ctypes/cfield.c | 14 | ||||
-rw-r--r-- | Modules/_ctypes/ctypes.h | 4 |
4 files changed, 1 insertions, 24 deletions
diff --git a/Modules/_ctypes/_ctypes_test.c b/Modules/_ctypes/_ctypes_test.c index 3c7f892..92c3b9e 100644 --- a/Modules/_ctypes/_ctypes_test.c +++ b/Modules/_ctypes/_ctypes_test.c @@ -233,7 +233,6 @@ EXPORT(int) _testfunc_callback_with_pointer(int (*func)(int *)) return (*func)(table); } -#ifdef HAVE_LONG_LONG EXPORT(PY_LONG_LONG) _testfunc_q_bhilfdq(signed char b, short h, int i, long l, float f, double d, PY_LONG_LONG q) { @@ -267,8 +266,6 @@ EXPORT(PY_LONG_LONG) _testfunc_callback_q_qf(PY_LONG_LONG value, return sum; } -#endif - typedef struct { char *name; char *value; diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c index a276fcd..5fc96f7 100644 --- a/Modules/_ctypes/callproc.c +++ b/Modules/_ctypes/callproc.c @@ -474,7 +474,6 @@ PyCArg_repr(PyCArgObject *self) self->tag, self->value.l); break; -#ifdef HAVE_LONG_LONG case 'q': case 'Q': sprintf(buffer, @@ -485,7 +484,6 @@ PyCArg_repr(PyCArgObject *self) #endif self->tag, self->value.q); break; -#endif case 'd': sprintf(buffer, "<cparam '%c' (%f)>", self->tag, self->value.d); @@ -593,9 +591,7 @@ union result { short h; int i; long l; -#ifdef HAVE_LONG_LONG PY_LONG_LONG q; -#endif long double D; double d; float f; diff --git a/Modules/_ctypes/cfield.c b/Modules/_ctypes/cfield.c index d666be5..06835cc 100644 --- a/Modules/_ctypes/cfield.c +++ b/Modules/_ctypes/cfield.c @@ -379,8 +379,6 @@ get_ulong(PyObject *v, unsigned long *p) return 0; } -#ifdef HAVE_LONG_LONG - /* Same, but handling native long long. */ static int @@ -417,8 +415,6 @@ get_ulonglong(PyObject *v, unsigned PY_LONG_LONG *p) return 0; } -#endif - /***************************************************************** * Integer fields, with bitfield support */ @@ -888,7 +884,6 @@ L_get_sw(void *ptr, Py_ssize_t size) return PyLong_FromUnsignedLong(val); } -#ifdef HAVE_LONG_LONG static PyObject * q_set(void *ptr, PyObject *value, Py_ssize_t size) { @@ -982,7 +977,6 @@ Q_get_sw(void *ptr, Py_ssize_t size) GET_BITFIELD(val, size); return PyLong_FromUnsignedLongLong(val); } -#endif /***************************************************************** * non-integer accessor methods, not supporting bit fields @@ -1490,9 +1484,7 @@ P_set(void *ptr, PyObject *value, Py_ssize_t size) #if SIZEOF_VOID_P <= SIZEOF_LONG v = (void *)PyLong_AsUnsignedLongMask(value); #else -#ifndef HAVE_LONG_LONG -# error "PyLong_AsVoidPtr: sizeof(void*) > sizeof(long), but no long long" -#elif SIZEOF_LONG_LONG < SIZEOF_VOID_P +#if SIZEOF_LONG_LONG < SIZEOF_VOID_P # error "PyLong_AsVoidPtr: sizeof(PY_LONG_LONG) < sizeof(void*)" #endif v = (void *)PyLong_AsUnsignedLongLongMask(value); @@ -1538,14 +1530,12 @@ static struct fielddesc formattable[] = { #else # error #endif -#ifdef HAVE_LONG_LONG #if SIZEOF_LONG_LONG == 8 { 'q', q_set, q_get, &ffi_type_sint64, q_set_sw, q_get_sw}, { 'Q', Q_set, Q_get, &ffi_type_uint64, Q_set_sw, Q_get_sw}, #else # error #endif -#endif { 'P', P_set, P_get, &ffi_type_pointer}, { 'z', z_set, z_get, &ffi_type_pointer}, #ifdef CTYPES_UNICODE @@ -1635,10 +1625,8 @@ typedef struct { char c; wchar_t *x; } s_wchar_p; #endif */ -#ifdef HAVE_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 /* from ffi.h: typedef struct _ffi_type diff --git a/Modules/_ctypes/ctypes.h b/Modules/_ctypes/ctypes.h index b4a9b78..64cb69f 100644 --- a/Modules/_ctypes/ctypes.h +++ b/Modules/_ctypes/ctypes.h @@ -31,9 +31,7 @@ union value { long l; float f; double d; -#ifdef HAVE_LONG_LONG PY_LONG_LONG ll; -#endif long double D; }; @@ -303,9 +301,7 @@ struct tagPyCArgObject { short h; int i; long l; -#ifdef HAVE_LONG_LONG PY_LONG_LONG q; -#endif long double D; double d; float f; |