diff options
author | Sergey Fedoseev <fedoseev.sergey@gmail.com> | 2019-12-05 14:55:28 (GMT) |
---|---|---|
committer | Victor Stinner <vstinner@python.org> | 2019-12-05 14:55:28 (GMT) |
commit | 1f9f69dd4c5ee232c0b2f782933a89359932a67f (patch) | |
tree | 1073e7f75e4986754a2805cd0103767d988a7612 /Modules/_testcapimodule.c | |
parent | 99eb70a9eb9493602ff6ad8bb92df4318cf05a3e (diff) | |
download | cpython-1f9f69dd4c5ee232c0b2f782933a89359932a67f.zip cpython-1f9f69dd4c5ee232c0b2f782933a89359932a67f.tar.gz cpython-1f9f69dd4c5ee232c0b2f782933a89359932a67f.tar.bz2 |
bpo-27961: Replace PY_LLONG_MAX, PY_LLONG_MIN and PY_ULLONG_MAX with standard macros (GH-15385)
Use standard constants LLONG_MIN, LLONG_MAX and ULLONG_MAX.
Diffstat (limited to 'Modules/_testcapimodule.c')
-rw-r--r-- | Modules/_testcapimodule.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index 0908f34..943bee6 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -639,7 +639,7 @@ test_long_long_and_overflow(PyObject *self, PyObject *Py_UNUSED(ignored)) int overflow; /* Test that overflow is set properly for a large value. */ - /* num is a number larger than PY_LLONG_MAX on a typical machine. */ + /* num is a number larger than LLONG_MAX on a typical machine. */ num = PyLong_FromString("FFFFFFFFFFFFFFFFFFFFFFFF", NULL, 16); if (num == NULL) return NULL; @@ -655,8 +655,8 @@ test_long_long_and_overflow(PyObject *self, PyObject *Py_UNUSED(ignored)) return raiseTestError("test_long_long_and_overflow", "overflow was not set to 1"); - /* Same again, with num = PY_LLONG_MAX + 1 */ - num = PyLong_FromLongLong(PY_LLONG_MAX); + /* Same again, with num = LLONG_MAX + 1 */ + num = PyLong_FromLongLong(LLONG_MAX); if (num == NULL) return NULL; one = PyLong_FromLong(1L); @@ -683,7 +683,7 @@ test_long_long_and_overflow(PyObject *self, PyObject *Py_UNUSED(ignored)) "overflow was not set to 1"); /* Test that overflow is set properly for a large negative value. */ - /* num is a number smaller than PY_LLONG_MIN on a typical platform */ + /* num is a number smaller than LLONG_MIN on a typical platform */ num = PyLong_FromString("-FFFFFFFFFFFFFFFFFFFFFFFF", NULL, 16); if (num == NULL) return NULL; @@ -699,8 +699,8 @@ test_long_long_and_overflow(PyObject *self, PyObject *Py_UNUSED(ignored)) return raiseTestError("test_long_long_and_overflow", "overflow was not set to -1"); - /* Same again, with num = PY_LLONG_MIN - 1 */ - num = PyLong_FromLongLong(PY_LLONG_MIN); + /* Same again, with num = LLONG_MIN - 1 */ + num = PyLong_FromLongLong(LLONG_MIN); if (num == NULL) return NULL; one = PyLong_FromLong(1L); @@ -757,7 +757,7 @@ test_long_long_and_overflow(PyObject *self, PyObject *Py_UNUSED(ignored)) return raiseTestError("test_long_long_and_overflow", "overflow was set incorrectly"); - num = PyLong_FromLongLong(PY_LLONG_MAX); + num = PyLong_FromLongLong(LLONG_MAX); if (num == NULL) return NULL; overflow = 1234; @@ -765,14 +765,14 @@ test_long_long_and_overflow(PyObject *self, PyObject *Py_UNUSED(ignored)) Py_DECREF(num); if (value == -1 && PyErr_Occurred()) return NULL; - if (value != PY_LLONG_MAX) + if (value != LLONG_MAX) return raiseTestError("test_long_long_and_overflow", - "expected return value PY_LLONG_MAX"); + "expected return value LLONG_MAX"); if (overflow != 0) return raiseTestError("test_long_long_and_overflow", "overflow was not cleared"); - num = PyLong_FromLongLong(PY_LLONG_MIN); + num = PyLong_FromLongLong(LLONG_MIN); if (num == NULL) return NULL; overflow = 0; @@ -780,9 +780,9 @@ test_long_long_and_overflow(PyObject *self, PyObject *Py_UNUSED(ignored)) Py_DECREF(num); if (value == -1 && PyErr_Occurred()) return NULL; - if (value != PY_LLONG_MIN) + if (value != LLONG_MIN) return raiseTestError("test_long_long_and_overflow", - "expected return value PY_LLONG_MIN"); + "expected return value LLONG_MIN"); if (overflow != 0) return raiseTestError("test_long_long_and_overflow", "overflow was not cleared"); @@ -6710,9 +6710,9 @@ PyInit__testcapi(void) PyModule_AddObject(m, "FLT_MIN", PyFloat_FromDouble(FLT_MIN)); PyModule_AddObject(m, "DBL_MAX", PyFloat_FromDouble(DBL_MAX)); PyModule_AddObject(m, "DBL_MIN", PyFloat_FromDouble(DBL_MIN)); - PyModule_AddObject(m, "LLONG_MAX", PyLong_FromLongLong(PY_LLONG_MAX)); - PyModule_AddObject(m, "LLONG_MIN", PyLong_FromLongLong(PY_LLONG_MIN)); - PyModule_AddObject(m, "ULLONG_MAX", PyLong_FromUnsignedLongLong(PY_ULLONG_MAX)); + PyModule_AddObject(m, "LLONG_MAX", PyLong_FromLongLong(LLONG_MAX)); + PyModule_AddObject(m, "LLONG_MIN", PyLong_FromLongLong(LLONG_MIN)); + PyModule_AddObject(m, "ULLONG_MAX", PyLong_FromUnsignedLongLong(ULLONG_MAX)); PyModule_AddObject(m, "PY_SSIZE_T_MAX", PyLong_FromSsize_t(PY_SSIZE_T_MAX)); PyModule_AddObject(m, "PY_SSIZE_T_MIN", PyLong_FromSsize_t(PY_SSIZE_T_MIN)); PyModule_AddObject(m, "SIZEOF_PYGC_HEAD", PyLong_FromSsize_t(sizeof(PyGC_Head))); |