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 | |
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')
-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 | ||||
-rw-r--r-- | Modules/_io/_iomodule.h | 2 | ||||
-rw-r--r-- | Modules/_lsprof.c | 4 | ||||
-rw-r--r-- | Modules/_multiprocessing/multiprocessing.h | 2 | ||||
-rw-r--r-- | Modules/_sqlite/util.c | 19 | ||||
-rw-r--r-- | Modules/_struct.c | 43 | ||||
-rw-r--r-- | Modules/_testcapimodule.c | 28 | ||||
-rw-r--r-- | Modules/_tkinter.c | 2 | ||||
-rw-r--r-- | Modules/addrinfo.h | 8 | ||||
-rw-r--r-- | Modules/arraymodule.c | 11 | ||||
-rw-r--r-- | Modules/posixmodule.c | 10 | ||||
-rw-r--r-- | Modules/resource.c | 4 |
15 files changed, 6 insertions, 152 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; diff --git a/Modules/_io/_iomodule.h b/Modules/_io/_iomodule.h index 3c48ff3..007e0c4 100644 --- a/Modules/_io/_iomodule.h +++ b/Modules/_io/_iomodule.h @@ -104,7 +104,7 @@ typedef off_t Py_off_t; # define PY_OFF_T_MIN PY_SSIZE_T_MIN # define PY_OFF_T_COMPAT Py_ssize_t # define PY_PRIdOFF "zd" -#elif (HAVE_LONG_LONG && SIZEOF_OFF_T == SIZEOF_LONG_LONG) +#elif (SIZEOF_OFF_T == SIZEOF_LONG_LONG) # define PyLong_AsOff_t PyLong_AsLongLong # define PyLong_FromOff_t PyLong_FromLongLong # define PY_OFF_T_MAX PY_LLONG_MAX diff --git a/Modules/_lsprof.c b/Modules/_lsprof.c index ccfb513..788d906 100644 --- a/Modules/_lsprof.c +++ b/Modules/_lsprof.c @@ -2,10 +2,6 @@ #include "frameobject.h" #include "rotatingtree.h" -#if !defined(HAVE_LONG_LONG) -#error "This module requires long longs!" -#endif - /*** Selection of a high-precision timer ***/ #ifdef MS_WINDOWS diff --git a/Modules/_multiprocessing/multiprocessing.h b/Modules/_multiprocessing/multiprocessing.h index 9aeea8d..512bc17 100644 --- a/Modules/_multiprocessing/multiprocessing.h +++ b/Modules/_multiprocessing/multiprocessing.h @@ -60,7 +60,7 @@ #if SIZEOF_VOID_P == SIZEOF_LONG # define F_POINTER "k" # define T_POINTER T_ULONG -#elif defined(HAVE_LONG_LONG) && (SIZEOF_VOID_P == SIZEOF_LONG_LONG) +#elif SIZEOF_VOID_P == SIZEOF_LONG_LONG # define F_POINTER "K" # define T_POINTER T_ULONGLONG #else diff --git a/Modules/_sqlite/util.c b/Modules/_sqlite/util.c index 312fe3b..a276dad 100644 --- a/Modules/_sqlite/util.c +++ b/Modules/_sqlite/util.c @@ -113,7 +113,6 @@ int _pysqlite_seterror(sqlite3* db, sqlite3_stmt* st) PyObject * _pysqlite_long_from_int64(sqlite_int64 value) { -#ifdef HAVE_LONG_LONG # if SIZEOF_LONG_LONG < 8 if (value > PY_LLONG_MAX || value < PY_LLONG_MIN) { return _PyLong_FromByteArray(&value, sizeof(value), @@ -124,14 +123,6 @@ _pysqlite_long_from_int64(sqlite_int64 value) if (value > LONG_MAX || value < LONG_MIN) return PyLong_FromLongLong(value); # endif -#else -# if SIZEOF_LONG < 8 - if (value > LONG_MAX || value < LONG_MIN) { - return _PyLong_FromByteArray(&value, sizeof(value), - IS_LITTLE_ENDIAN, 1 /* signed */); - } -# endif -#endif return PyLong_FromLong(Py_SAFE_DOWNCAST(value, sqlite_int64, long)); } @@ -139,23 +130,13 @@ sqlite_int64 _pysqlite_long_as_int64(PyObject * py_val) { int overflow; -#ifdef HAVE_LONG_LONG PY_LONG_LONG value = PyLong_AsLongLongAndOverflow(py_val, &overflow); -#else - long value = PyLong_AsLongAndOverflow(py_val, &overflow); -#endif if (value == -1 && PyErr_Occurred()) return -1; if (!overflow) { -#ifdef HAVE_LONG_LONG # if SIZEOF_LONG_LONG > 8 if (-0x8000000000000000LL <= value && value <= 0x7FFFFFFFFFFFFFFFLL) # endif -#else -# if SIZEOF_LONG > 8 - if (-0x8000000000000000L <= value && value <= 0x7FFFFFFFFFFFFFFFL) -# endif -#endif return value; } else if (sizeof(value) < sizeof(sqlite_int64)) { diff --git a/Modules/_struct.c b/Modules/_struct.c index 2bcd492..ba60ba6 100644 --- a/Modules/_struct.c +++ b/Modules/_struct.c @@ -71,10 +71,8 @@ typedef struct { char c; size_t x; } st_size_t; /* 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; PY_LONG_LONG x; } s_long_long; #define LONG_LONG_ALIGN (sizeof(s_long_long) - sizeof(PY_LONG_LONG)) -#endif #ifdef HAVE_C99_BOOL #define BOOL_TYPE _Bool @@ -164,8 +162,6 @@ get_ulong(PyObject *v, unsigned long *p) return 0; } -#ifdef HAVE_LONG_LONG - /* Same, but handling native long long. */ static int @@ -212,8 +208,6 @@ get_ulonglong(PyObject *v, unsigned PY_LONG_LONG *p) return 0; } -#endif - /* Same, but handling Py_ssize_t */ static int @@ -463,8 +457,6 @@ nu_size_t(const char *p, const formatdef *f) /* Native mode doesn't support q or Q unless the platform C supports long long (or, on Windows, __int64). */ -#ifdef HAVE_LONG_LONG - static PyObject * nu_longlong(const char *p, const formatdef *f) { @@ -485,8 +477,6 @@ nu_ulonglong(const char *p, const formatdef *f) return PyLong_FromUnsignedLongLong(x); } -#endif - static PyObject * nu_bool(const char *p, const formatdef *f) { @@ -680,8 +670,6 @@ np_size_t(char *p, PyObject *v, const formatdef *f) return 0; } -#ifdef HAVE_LONG_LONG - static int np_longlong(char *p, PyObject *v, const formatdef *f) { @@ -701,7 +689,6 @@ np_ulonglong(char *p, PyObject *v, const formatdef *f) memcpy(p, (char *)&x, sizeof x); return 0; } -#endif static int @@ -785,10 +772,8 @@ static const formatdef native_table[] = { {'L', sizeof(long), LONG_ALIGN, nu_ulong, np_ulong}, {'n', sizeof(size_t), SIZE_T_ALIGN, nu_ssize_t, np_ssize_t}, {'N', sizeof(size_t), SIZE_T_ALIGN, nu_size_t, np_size_t}, -#ifdef HAVE_LONG_LONG {'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 {'?', sizeof(BOOL_TYPE), BOOL_ALIGN, nu_bool, np_bool}, {'e', sizeof(short), SHORT_ALIGN, nu_halffloat, np_halffloat}, {'f', sizeof(float), FLOAT_ALIGN, nu_float, np_float}, @@ -831,7 +816,6 @@ bu_uint(const char *p, const formatdef *f) static PyObject * bu_longlong(const char *p, const formatdef *f) { -#ifdef HAVE_LONG_LONG PY_LONG_LONG x = 0; Py_ssize_t i = f->size; const unsigned char *bytes = (const unsigned char *)p; @@ -844,18 +828,11 @@ bu_longlong(const char *p, const formatdef *f) if (x >= LONG_MIN && x <= LONG_MAX) return PyLong_FromLong(Py_SAFE_DOWNCAST(x, PY_LONG_LONG, long)); return PyLong_FromLongLong(x); -#else - return _PyLong_FromByteArray((const unsigned char *)p, - 8, - 0, /* little-endian */ - 1 /* signed */); -#endif } static PyObject * bu_ulonglong(const char *p, const formatdef *f) { -#ifdef HAVE_LONG_LONG unsigned PY_LONG_LONG x = 0; Py_ssize_t i = f->size; const unsigned char *bytes = (const unsigned char *)p; @@ -865,12 +842,6 @@ bu_ulonglong(const char *p, const formatdef *f) if (x <= LONG_MAX) return PyLong_FromLong(Py_SAFE_DOWNCAST(x, unsigned PY_LONG_LONG, long)); return PyLong_FromUnsignedLongLong(x); -#else - return _PyLong_FromByteArray((const unsigned char *)p, - 8, - 0, /* little-endian */ - 0 /* signed */); -#endif } static PyObject * @@ -1072,7 +1043,6 @@ lu_uint(const char *p, const formatdef *f) static PyObject * lu_longlong(const char *p, const formatdef *f) { -#ifdef HAVE_LONG_LONG PY_LONG_LONG x = 0; Py_ssize_t i = f->size; const unsigned char *bytes = (const unsigned char *)p; @@ -1085,18 +1055,11 @@ lu_longlong(const char *p, const formatdef *f) if (x >= LONG_MIN && x <= LONG_MAX) return PyLong_FromLong(Py_SAFE_DOWNCAST(x, PY_LONG_LONG, long)); return PyLong_FromLongLong(x); -#else - return _PyLong_FromByteArray((const unsigned char *)p, - 8, - 1, /* little-endian */ - 1 /* signed */); -#endif } static PyObject * lu_ulonglong(const char *p, const formatdef *f) { -#ifdef HAVE_LONG_LONG unsigned PY_LONG_LONG x = 0; Py_ssize_t i = f->size; const unsigned char *bytes = (const unsigned char *)p; @@ -1106,12 +1069,6 @@ lu_ulonglong(const char *p, const formatdef *f) if (x <= LONG_MAX) return PyLong_FromLong(Py_SAFE_DOWNCAST(x, unsigned PY_LONG_LONG, long)); return PyLong_FromUnsignedLongLong(x); -#else - return _PyLong_FromByteArray((const unsigned char *)p, - 8, - 1, /* little-endian */ - 0 /* signed */); -#endif } static PyObject * diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index 6fabc40..7b6c2c1 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -60,9 +60,7 @@ test_config(PyObject *self) CHECK_SIZEOF(SIZEOF_LONG, long); CHECK_SIZEOF(SIZEOF_VOID_P, void*); CHECK_SIZEOF(SIZEOF_TIME_T, time_t); -#ifdef HAVE_LONG_LONG CHECK_SIZEOF(SIZEOF_LONG_LONG, PY_LONG_LONG); -#endif #undef CHECK_SIZEOF @@ -357,7 +355,7 @@ test_lazy_hash_inheritance(PyObject* self) } -/* Tests of PyLong_{As, From}{Unsigned,}Long(), and (#ifdef HAVE_LONG_LONG) +/* Tests of PyLong_{As, From}{Unsigned,}Long(), and PyLong_{As, From}{Unsigned,}LongLong(). Note that the meat of the test is contained in testcapi_long.h. @@ -402,8 +400,6 @@ test_long_api(PyObject* self) #undef F_U_TO_PY #undef F_PY_TO_U -#ifdef HAVE_LONG_LONG - static PyObject * raise_test_longlong_error(const char* msg) { @@ -870,8 +866,6 @@ test_L_code(PyObject *self) return Py_None; } -#endif /* ifdef HAVE_LONG_LONG */ - static PyObject * return_none(void *unused) { @@ -1136,7 +1130,6 @@ getargs_p(PyObject *self, PyObject *args) return PyLong_FromLong(value); } -#ifdef HAVE_LONG_LONG static PyObject * getargs_L(PyObject *self, PyObject *args) { @@ -1154,7 +1147,6 @@ getargs_K(PyObject *self, PyObject *args) return NULL; return PyLong_FromUnsignedLongLong(value); } -#endif /* This function not only tests the 'k' getargs code, but also the PyLong_AsUnsignedLongMask() and PyLong_AsUnsignedLongMask() functions. */ @@ -2279,10 +2271,8 @@ test_string_from_format(PyObject *self, PyObject *args) CHECK_1_FORMAT("%zu", size_t); /* "%lld" and "%llu" support added in Python 2.7. */ -#ifdef HAVE_LONG_LONG CHECK_1_FORMAT("%llu", unsigned PY_LONG_LONG); CHECK_1_FORMAT("%lld", PY_LONG_LONG); -#endif Py_RETURN_NONE; @@ -3991,14 +3981,12 @@ static PyMethodDef TestMethods[] = { {"getargs_l", getargs_l, METH_VARARGS}, {"getargs_n", getargs_n, METH_VARARGS}, {"getargs_p", getargs_p, METH_VARARGS}, -#ifdef HAVE_LONG_LONG {"getargs_L", getargs_L, METH_VARARGS}, {"getargs_K", getargs_K, METH_VARARGS}, {"test_longlong_api", test_longlong_api, METH_NOARGS}, {"test_long_long_and_overflow", (PyCFunction)test_long_long_and_overflow, METH_NOARGS}, {"test_L_code", (PyCFunction)test_L_code, METH_NOARGS}, -#endif {"getargs_f", getargs_f, METH_VARARGS}, {"getargs_d", getargs_d, METH_VARARGS}, {"getargs_D", getargs_D, METH_VARARGS}, @@ -4153,10 +4141,8 @@ typedef struct { float float_member; double double_member; char inplace_member[6]; -#ifdef HAVE_LONG_LONG PY_LONG_LONG longlong_member; unsigned PY_LONG_LONG ulonglong_member; -#endif } all_structmembers; typedef struct { @@ -4178,10 +4164,8 @@ static struct PyMemberDef test_members[] = { {"T_FLOAT", T_FLOAT, offsetof(test_structmembers, structmembers.float_member), 0, NULL}, {"T_DOUBLE", T_DOUBLE, offsetof(test_structmembers, structmembers.double_member), 0, NULL}, {"T_STRING_INPLACE", T_STRING_INPLACE, offsetof(test_structmembers, structmembers.inplace_member), 0, NULL}, -#ifdef HAVE_LONG_LONG {"T_LONGLONG", T_LONGLONG, offsetof(test_structmembers, structmembers.longlong_member), 0, NULL}, {"T_ULONGLONG", T_ULONGLONG, offsetof(test_structmembers, structmembers.ulonglong_member), 0, NULL}, -#endif {NULL} }; @@ -4193,15 +4177,9 @@ test_structmembers_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) "T_BOOL", "T_BYTE", "T_UBYTE", "T_SHORT", "T_USHORT", "T_INT", "T_UINT", "T_LONG", "T_ULONG", "T_PYSSIZET", "T_FLOAT", "T_DOUBLE", "T_STRING_INPLACE", -#ifdef HAVE_LONG_LONG "T_LONGLONG", "T_ULONGLONG", -#endif NULL}; - static const char fmt[] = "|bbBhHiIlknfds#" -#ifdef HAVE_LONG_LONG - "LK" -#endif - ; + static const char fmt[] = "|bbBhHiIlknfds#LK"; test_structmembers *ob; const char *s = NULL; Py_ssize_t string_len = 0; @@ -4223,10 +4201,8 @@ test_structmembers_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) &ob->structmembers.float_member, &ob->structmembers.double_member, &s, &string_len -#ifdef HAVE_LONG_LONG , &ob->structmembers.longlong_member, &ob->structmembers.ulonglong_member -#endif )) { Py_DECREF(ob); return NULL; diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c index 42771e3..8afc4d5 100644 --- a/Modules/_tkinter.c +++ b/Modules/_tkinter.c @@ -1182,10 +1182,8 @@ fromWideIntObj(PyObject* tkapp, Tcl_Obj *value) { Tcl_WideInt wideValue; if (Tcl_GetWideIntFromObj(Tkapp_Interp(tkapp), value, &wideValue) == TCL_OK) { -#ifdef HAVE_LONG_LONG if (sizeof(wideValue) <= SIZEOF_LONG_LONG) return PyLong_FromLongLong(wideValue); -#endif return _PyLong_FromByteArray((unsigned char *)(void *)&wideValue, sizeof(wideValue), PY_LITTLE_ENDIAN, diff --git a/Modules/addrinfo.h b/Modules/addrinfo.h index 1cb6f0e..20f7650 100644 --- a/Modules/addrinfo.h +++ b/Modules/addrinfo.h @@ -141,11 +141,7 @@ struct addrinfo { * RFC 2553: protocol-independent placeholder for socket addresses */ #define _SS_MAXSIZE 128 -#ifdef HAVE_LONG_LONG #define _SS_ALIGNSIZE (sizeof(PY_LONG_LONG)) -#else -#define _SS_ALIGNSIZE (sizeof(double)) -#endif /* HAVE_LONG_LONG */ #define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(u_char) * 2) #define _SS_PAD2SIZE (_SS_MAXSIZE - sizeof(u_char) * 2 - \ _SS_PAD1SIZE - _SS_ALIGNSIZE) @@ -158,11 +154,7 @@ struct sockaddr_storage { unsigned short ss_family; /* address family */ #endif /* HAVE_SOCKADDR_SA_LEN */ char __ss_pad1[_SS_PAD1SIZE]; -#ifdef HAVE_LONG_LONG PY_LONG_LONG __ss_align; /* force desired structure storage alignment */ -#else - double __ss_align; /* force desired structure storage alignment */ -#endif /* HAVE_LONG_LONG */ char __ss_pad2[_SS_PAD2SIZE]; }; #endif /* !HAVE_SOCKADDR_STORAGE */ diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c index 4d9a23f..8637cb5 100644 --- a/Modules/arraymodule.c +++ b/Modules/arraymodule.c @@ -418,8 +418,6 @@ LL_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v) return 0; } -#ifdef HAVE_LONG_LONG - static PyObject * q_getitem(arrayobject *ap, Py_ssize_t i) { @@ -469,7 +467,6 @@ QQ_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v) ((unsigned PY_LONG_LONG *)ap->ob_item)[i] = x; return 0; } -#endif static PyObject * f_getitem(arrayobject *ap, Py_ssize_t i) @@ -521,10 +518,8 @@ static const struct arraydescr descriptors[] = { {'I', sizeof(int), II_getitem, II_setitem, "I", 1, 0}, {'l', sizeof(long), l_getitem, l_setitem, "l", 1, 1}, {'L', sizeof(long), LL_getitem, LL_setitem, "L", 1, 0}, -#ifdef HAVE_LONG_LONG {'q', sizeof(PY_LONG_LONG), q_getitem, q_setitem, "q", 1, 1}, {'Q', sizeof(PY_LONG_LONG), QQ_getitem, QQ_setitem, "Q", 1, 0}, -#endif {'f', sizeof(float), f_getitem, f_setitem, "f", 0, 0}, {'d', sizeof(double), d_getitem, d_setitem, "d", 0, 0}, {'\0', 0, 0, 0, 0, 0, 0} /* Sentinel */ @@ -1814,7 +1809,6 @@ typecode_to_mformat_code(char typecode) intsize = sizeof(long); is_signed = 0; break; -#if HAVE_LONG_LONG case 'q': intsize = sizeof(PY_LONG_LONG); is_signed = 1; @@ -1823,7 +1817,6 @@ typecode_to_mformat_code(char typecode) intsize = sizeof(PY_LONG_LONG); is_signed = 0; break; -#endif default: return UNKNOWN_FORMAT; } @@ -2685,11 +2678,7 @@ array_new(PyTypeObject *type, PyObject *args, PyObject *kwds) } } PyErr_SetString(PyExc_ValueError, -#ifdef HAVE_LONG_LONG "bad typecode (must be b, B, u, h, H, i, I, l, L, q, Q, f or d)"); -#else - "bad typecode (must be b, B, u, h, H, i, I, l, L, f or d)"); -#endif return NULL; } diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index c9ac1f7..21d91b0 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -640,22 +640,14 @@ fail: #endif /* MS_WINDOWS */ -#ifdef HAVE_LONG_LONG -# define _PyLong_FromDev PyLong_FromLongLong -#else -# define _PyLong_FromDev PyLong_FromLong -#endif +#define _PyLong_FromDev PyLong_FromLongLong #if defined(HAVE_MKNOD) && defined(HAVE_MAKEDEV) static int _Py_Dev_Converter(PyObject *obj, void *p) { -#ifdef HAVE_LONG_LONG *((dev_t *)p) = PyLong_AsUnsignedLongLong(obj); -#else - *((dev_t *)p) = PyLong_AsUnsignedLong(obj); -#endif if (PyErr_Occurred()) return 0; return 1; diff --git a/Modules/resource.c b/Modules/resource.c index 3a1cf09..bbe8aef 100644 --- a/Modules/resource.c +++ b/Modules/resource.c @@ -135,13 +135,11 @@ py2rlimit(PyObject *curobj, PyObject *maxobj, struct rlimit *rl_out) static PyObject* rlimit2py(struct rlimit rl) { -#if defined(HAVE_LONG_LONG) if (sizeof(rl.rlim_cur) > sizeof(long)) { return Py_BuildValue("LL", (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); } @@ -438,11 +436,9 @@ PyInit_resource(void) PyModule_AddIntMacro(m, RLIMIT_NPTS); #endif -#if defined(HAVE_LONG_LONG) if (sizeof(RLIM_INFINITY) > sizeof(long)) { v = PyLong_FromLongLong((PY_LONG_LONG) RLIM_INFINITY); } else -#endif { v = PyLong_FromLong((long) RLIM_INFINITY); } |