| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -524,11 +524,6 @@ APIs: | |||
| 524 | 524 | An unrecognized format character causes all the rest of the format string to be | |
| 525 | 525 | copied as-is to the result string, and any extra arguments discarded. | |
| 526 | 526 | ||
| 527 | - .. note:: | ||
| 528 | - | ||
| 529 | - The `"%lld"` and `"%llu"` format specifiers are only available | ||
| 530 | - when :const:`HAVE_LONG_LONG` is defined. | ||
| 531 | - | ||
| 532 | 527 | .. note:: | |
| 533 | 528 | The width formatter unit is number of characters rather than bytes. | |
| 534 | 529 | The precision formatter unit is number of bytes for ``"%s"`` and | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -85,14 +85,12 @@ PyAPI_FUNC(double) PyLong_AsDouble(PyObject *); | |||
| 85 | 85 | PyAPI_FUNC(PyObject *) PyLong_FromVoidPtr(void *); | |
| 86 | 86 | PyAPI_FUNC(void *) PyLong_AsVoidPtr(PyObject *); | |
| 87 | 87 | ||
| 88 | - #ifdef HAVE_LONG_LONG | ||
| 89 | 88 | PyAPI_FUNC(PyObject *) PyLong_FromLongLong(PY_LONG_LONG); | |
| 90 | 89 | PyAPI_FUNC(PyObject *) PyLong_FromUnsignedLongLong(unsigned PY_LONG_LONG); | |
| 91 | 90 | PyAPI_FUNC(PY_LONG_LONG) PyLong_AsLongLong(PyObject *); | |
| 92 | 91 | PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLong(PyObject *); | |
| 93 | 92 | PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLongMask(PyObject *); | |
| 94 | 93 | PyAPI_FUNC(PY_LONG_LONG) PyLong_AsLongLongAndOverflow(PyObject *, int *); | |
| 95 | - #endif /* HAVE_LONG_LONG */ | ||
| 96 | 94 | ||
| 97 | 95 | PyAPI_FUNC(PyObject *) PyLong_FromString(const char *, char **, int); | |
| 98 | 96 | #ifndef Py_LIMITED_API | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -35,10 +35,6 @@ HAVE_UINTPTR_T | |||
| 35 | 35 | Meaning: The C9X type uintptr_t is supported by the compiler | |
| 36 | 36 | Used in: Py_uintptr_t | |
| 37 | 37 | ||
| 38 | - HAVE_LONG_LONG | ||
| 39 | - Meaning: The compiler supports the C type "long long" | ||
| 40 | - Used in: PY_LONG_LONG | ||
| 41 | - | ||
| 42 | 38 | **************************************************************************/ | |
| 43 | 39 | ||
| 44 | 40 | /* typedefs for some C9X-defined synonyms for integral types. | |
@@ -53,7 +49,6 @@ Used in: PY_LONG_LONG | |||
| 53 | 49 | * integral synonyms. Only define the ones we actually need. | |
| 54 | 50 | */ | |
| 55 | 51 | ||
| 56 | - #ifdef HAVE_LONG_LONG | ||
| 57 | 52 | #ifndef PY_LONG_LONG | |
| 58 | 53 | #define PY_LONG_LONG long long | |
| 59 | 54 | #if defined(LLONG_MAX) | |
@@ -78,7 +73,6 @@ Used in: PY_LONG_LONG | |||
| 78 | 73 | #define PY_ULLONG_MAX (PY_LLONG_MAX * Py_ULL(2) + 1) | |
| 79 | 74 | #endif /* LLONG_MAX */ | |
| 80 | 75 | #endif | |
| 81 | - #endif /* HAVE_LONG_LONG */ | ||
| 82 | 76 | ||
| 83 | 77 | /* a build with 30-bit digits for Python integers needs an exact-width | |
| 84 | 78 | * 32-bit unsigned integer type to store those digits. (We could just use | |
@@ -161,7 +155,7 @@ typedef int Py_intptr_t; | |||
| 161 | 155 | typedef unsigned long Py_uintptr_t; | |
| 162 | 156 | typedef long Py_intptr_t; | |
| 163 | 157 | ||
| 164 | - #elif defined(HAVE_LONG_LONG) && (SIZEOF_VOID_P <= SIZEOF_LONG_LONG) | ||
| 158 | + #elif SIZEOF_VOID_P <= SIZEOF_LONG_LONG | ||
| 165 | 159 | typedef unsigned PY_LONG_LONG Py_uintptr_t; | |
| 166 | 160 | typedef PY_LONG_LONG Py_intptr_t; | |
| 167 | 161 | ||
@@ -248,19 +242,16 @@ typedef int Py_ssize_clean_t; | |||
| 248 | 242 | #endif | |
| 249 | 243 | ||
| 250 | 244 | /* PY_FORMAT_LONG_LONG is analogous to PY_FORMAT_SIZE_T above, but for | |
| 251 | - * the long long type instead of the size_t type. It's only available | ||
| 252 | - * when HAVE_LONG_LONG is defined. The "high level" Python format | ||
| 245 | + * the long long type instead of the size_t type. The "high level" Python format | ||
| 253 | 246 | * functions listed above will interpret "lld" or "llu" correctly on | |
| 254 | 247 | * all platforms. | |
| 255 | 248 | */ | |
| 256 | - #ifdef HAVE_LONG_LONG | ||
| 257 | - # ifndef PY_FORMAT_LONG_LONG | ||
| 258 | - # ifdef MS_WINDOWS | ||
| 259 | - # define PY_FORMAT_LONG_LONG "I64" | ||
| 260 | - # else | ||
| 261 | - # error "This platform's pyconfig.h needs to define PY_FORMAT_LONG_LONG" | ||
| 262 | - # endif | ||
| 263 | - # endif | ||
| 249 | + #ifndef PY_FORMAT_LONG_LONG | ||
| 250 | + # ifdef MS_WINDOWS | ||
| 251 | + # define PY_FORMAT_LONG_LONG "I64" | ||
| 252 | + # else | ||
| 253 | + # error "This platform's pyconfig.h needs to define PY_FORMAT_LONG_LONG" | ||
| 254 | + # endif | ||
| 264 | 255 | #endif | |
| 265 | 256 | ||
| 266 | 257 | /* Py_LOCAL can be used instead of static to get the fastest possible calling | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -37,13 +37,8 @@ PyAPI_FUNC(int) PyThread_acquire_lock(PyThread_type_lock, int); | |||
| 37 | 37 | module exposes a higher-level API, with timeouts expressed in seconds | |
| 38 | 38 | and floating-point numbers allowed. | |
| 39 | 39 | */ | |
| 40 | - #if defined(HAVE_LONG_LONG) | ||
| 41 | 40 | #define PY_TIMEOUT_T PY_LONG_LONG | |
| 42 | 41 | #define PY_TIMEOUT_MAX PY_LLONG_MAX | |
| 43 | - #else | ||
| 44 | - #define PY_TIMEOUT_T long | ||
| 45 | - #define PY_TIMEOUT_MAX LONG_MAX | ||
| 46 | - #endif | ||
| 47 | 42 | ||
| 48 | 43 | /* In the NT API, the timeout is a DWORD and is expressed in milliseconds */ | |
| 49 | 44 | #if defined (NT_THREADS) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -49,10 +49,8 @@ typedef struct PyMemberDef { | |||
| 49 | 49 | #define T_OBJECT_EX 16 /* Like T_OBJECT, but raises AttributeError | |
| 50 | 50 | when the value is NULL, instead of | |
| 51 | 51 | converting to None. */ | |
| 52 | - #ifdef HAVE_LONG_LONG | ||
| 53 | 52 | #define T_LONGLONG 17 | |
| 54 | 53 | #define T_ULONGLONG 18 | |
| 55 | - #endif /* HAVE_LONG_LONG */ | ||
| 56 | 54 | ||
| 57 | 55 | #define T_PYSSIZET 19 /* Py_ssize_t */ | |
| 58 | 56 | #define T_NONE 20 /* Value is always None */ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -16,22 +16,10 @@ | |||
| 16 | 16 | def iter_integer_formats(byteorders=byteorders): | |
| 17 | 17 | for code in integer_codes: | |
| 18 | 18 | for byteorder in byteorders: | |
| 19 | - if (byteorder in ('', '@') and code in ('q', 'Q') and | ||
| 20 | - not HAVE_LONG_LONG): | ||
| 21 | - continue | ||
| 22 | 19 | if (byteorder not in ('', '@') and code in ('n', 'N')): | |
| 23 | 20 | continue | |
| 24 | 21 | yield code, byteorder | |
| 25 | 22 | ||
| 26 | - # Native 'q' packing isn't available on systems that don't have the C | ||
| 27 | - # long long type. | ||
| 28 | - try: | ||
| 29 | - struct.pack('q', 5) | ||
| 30 | - except struct.error: | ||
| 31 | - HAVE_LONG_LONG = False | ||
| 32 | - else: | ||
| 33 | - HAVE_LONG_LONG = True | ||
| 34 | - | ||
| 35 | 23 | def string_reverse(s): | |
| 36 | 24 | return s[::-1] | |
| 37 | 25 | ||
@@ -159,9 +147,7 @@ def test_calcsize(self): | |||
| 159 | 147 | self.assertEqual(size, expected_size[code]) | |
| 160 | 148 | ||
| 161 | 149 | # native integer sizes | |
| 162 | - native_pairs = 'bB', 'hH', 'iI', 'lL', 'nN' | ||
| 163 | - if HAVE_LONG_LONG: | ||
| 164 | - native_pairs += 'qQ', | ||
| 150 | + native_pairs = 'bB', 'hH', 'iI', 'lL', 'nN', 'qQ' | ||
| 165 | 151 | for format_pair in native_pairs: | |
| 166 | 152 | for byteorder in '', '@': | |
| 167 | 153 | signed_size = struct.calcsize(byteorder + format_pair[0]) | |
@@ -174,9 +160,8 @@ def test_calcsize(self): | |||
| 174 | 160 | self.assertLessEqual(4, struct.calcsize('l')) | |
| 175 | 161 | self.assertLessEqual(struct.calcsize('h'), struct.calcsize('i')) | |
| 176 | 162 | self.assertLessEqual(struct.calcsize('i'), struct.calcsize('l')) | |
| 177 | - if HAVE_LONG_LONG: | ||
| 178 | - self.assertLessEqual(8, struct.calcsize('q')) | ||
| 179 | - self.assertLessEqual(struct.calcsize('l'), struct.calcsize('q')) | ||
| 163 | + self.assertLessEqual(8, struct.calcsize('q')) | ||
| 164 | + self.assertLessEqual(struct.calcsize('l'), struct.calcsize('q')) | ||
| 180 | 165 | self.assertGreaterEqual(struct.calcsize('n'), struct.calcsize('i')) | |
| 181 | 166 | self.assertGreaterEqual(struct.calcsize('n'), struct.calcsize('P')) | |
| 182 | 167 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,6 +10,9 @@ What's New in Python 3.6.0 beta 1 | |||
| 10 | 10 | Core and Builtins | |
| 11 | 11 | ----------------- | |
| 12 | 12 | ||
| 13 | + - Issue #27961?: Require platforms to support ``long long``. Python hasn't | ||
| 14 | + compiled without ``long long`` for years, so this is basically a formality. | ||
| 15 | + | ||
| 13 | 16 | - Issue #27355: Removed support for Windows CE. It was never finished, | |
| 14 | 17 | and Windows CE is no longer a relevant platform for Python. | |
| 15 | 18 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -233,7 +233,6 @@ EXPORT(int) _testfunc_callback_with_pointer(int (*func)(int *)) | |||
| 233 | 233 | return (*func)(table); | |
| 234 | 234 | } | |
| 235 | 235 | ||
| 236 | - #ifdef HAVE_LONG_LONG | ||
| 237 | 236 | EXPORT(PY_LONG_LONG) _testfunc_q_bhilfdq(signed char b, short h, int i, long l, float f, | |
| 238 | 237 | double d, PY_LONG_LONG q) | |
| 239 | 238 | { | |
@@ -267,8 +266,6 @@ EXPORT(PY_LONG_LONG) _testfunc_callback_q_qf(PY_LONG_LONG value, | |||
| 267 | 266 | return sum; | |
| 268 | 267 | } | |
| 269 | 268 | ||
| 270 | - #endif | ||
| 271 | - | ||
| 272 | 269 | typedef struct { | |
| 273 | 270 | char *name; | |
| 274 | 271 | char *value; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -474,7 +474,6 @@ PyCArg_repr(PyCArgObject *self) | |||
| 474 | 474 | self->tag, self->value.l); | |
| 475 | 475 | break; | |
| 476 | 476 | ||
| 477 | - #ifdef HAVE_LONG_LONG | ||
| 478 | 477 | case 'q': | |
| 479 | 478 | case 'Q': | |
| 480 | 479 | sprintf(buffer, | |
@@ -485,7 +484,6 @@ PyCArg_repr(PyCArgObject *self) | |||
| 485 | 484 | #endif | |
| 486 | 485 | self->tag, self->value.q); | |
| 487 | 486 | break; | |
| 488 | - #endif | ||
| 489 | 487 | case 'd': | |
| 490 | 488 | sprintf(buffer, "<cparam '%c' (%f)>", | |
| 491 | 489 | self->tag, self->value.d); | |
@@ -593,9 +591,7 @@ union result { | |||
| 593 | 591 | short h; | |
| 594 | 592 | int i; | |
| 595 | 593 | long l; | |
| 596 | - #ifdef HAVE_LONG_LONG | ||
| 597 | 594 | PY_LONG_LONG q; | |
| 598 | - #endif | ||
| 599 | 595 | long double D; | |
| 600 | 596 | double d; | |
| 601 | 597 | float f; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -379,8 +379,6 @@ get_ulong(PyObject *v, unsigned long *p) | |||
| 379 | 379 | return 0; | |
| 380 | 380 | } | |
| 381 | 381 | ||
| 382 | - #ifdef HAVE_LONG_LONG | ||
| 383 | - | ||
| 384 | 382 | /* Same, but handling native long long. */ | |
| 385 | 383 | ||
| 386 | 384 | static int | |
@@ -417,8 +415,6 @@ get_ulonglong(PyObject *v, unsigned PY_LONG_LONG *p) | |||
| 417 | 415 | return 0; | |
| 418 | 416 | } | |
| 419 | 417 | ||
| 420 | - #endif | ||
| 421 | - | ||
| 422 | 418 | /***************************************************************** | |
| 423 | 419 | * Integer fields, with bitfield support | |
| 424 | 420 | */ | |
@@ -888,7 +884,6 @@ L_get_sw(void *ptr, Py_ssize_t size) | |||
| 888 | 884 | return PyLong_FromUnsignedLong(val); | |
| 889 | 885 | } | |
| 890 | 886 | ||
| 891 | - #ifdef HAVE_LONG_LONG | ||
| 892 | 887 | static PyObject * | |
| 893 | 888 | q_set(void *ptr, PyObject *value, Py_ssize_t size) | |
| 894 | 889 | { | |
@@ -982,7 +977,6 @@ Q_get_sw(void *ptr, Py_ssize_t size) | |||
| 982 | 977 | GET_BITFIELD(val, size); | |
| 983 | 978 | return PyLong_FromUnsignedLongLong(val); | |
| 984 | 979 | } | |
| 985 | - #endif | ||
| 986 | 980 | ||
| 987 | 981 | /***************************************************************** | |
| 988 | 982 | * non-integer accessor methods, not supporting bit fields | |
@@ -1490,9 +1484,7 @@ P_set(void *ptr, PyObject *value, Py_ssize_t size) | |||
| 1490 | 1484 | #if SIZEOF_VOID_P <= SIZEOF_LONG | |
| 1491 | 1485 | v = (void *)PyLong_AsUnsignedLongMask(value); | |
| 1492 | 1486 | #else | |
| 1493 | - #ifndef HAVE_LONG_LONG | ||
| 1494 | - # error "PyLong_AsVoidPtr: sizeof(void*) > sizeof(long), but no long long" | ||
| 1495 | - #elif SIZEOF_LONG_LONG < SIZEOF_VOID_P | ||
| 1487 | + #if SIZEOF_LONG_LONG < SIZEOF_VOID_P | ||
| 1496 | 1488 | # error "PyLong_AsVoidPtr: sizeof(PY_LONG_LONG) < sizeof(void*)" | |
| 1497 | 1489 | #endif | |
| 1498 | 1490 | v = (void *)PyLong_AsUnsignedLongLongMask(value); | |
@@ -1538,13 +1530,11 @@ static struct fielddesc formattable[] = { | |||
| 1538 | 1530 | #else | |
| 1539 | 1531 | # error | |
| 1540 | 1532 | #endif | |
| 1541 | - #ifdef HAVE_LONG_LONG | ||
| 1542 | 1533 | #if SIZEOF_LONG_LONG == 8 | |
| 1543 | 1534 | { 'q', q_set, q_get, &ffi_type_sint64, q_set_sw, q_get_sw}, | |
| 1544 | 1535 | { 'Q', Q_set, Q_get, &ffi_type_uint64, Q_set_sw, Q_get_sw}, | |
| 1545 | 1536 | #else | |
| 1546 | 1537 | # error | |
| 1547 | - #endif | ||
| 1548 | 1538 | #endif | |
| 1549 | 1539 | { 'P', P_set, P_get, &ffi_type_pointer}, | |
| 1550 | 1540 | { 'z', z_set, z_get, &ffi_type_pointer}, | |
@@ -1635,10 +1625,8 @@ typedef struct { char c; wchar_t *x; } s_wchar_p; | |||
| 1635 | 1625 | #endif | |
| 1636 | 1626 | */ | |
| 1637 | 1627 | ||
| 1638 | - #ifdef HAVE_LONG_LONG | ||
| 1639 | 1628 | typedef struct { char c; PY_LONG_LONG x; } s_long_long; | |
| 1640 | 1629 | #define LONG_LONG_ALIGN (sizeof(s_long_long) - sizeof(PY_LONG_LONG)) | |
| 1641 | - #endif | ||
| 1642 | 1630 | ||
| 1643 | 1631 | /* from ffi.h: | |
| 1644 | 1632 | typedef struct _ffi_type | |
| Back | FazBrowse Home | New Git URL |
0 commit comments