From 6bc397378f83be4d67f15f5d15a8a5f73f356311 Mon Sep 17 00:00:00 2001 From: Dong-hee Na Date: Sun, 21 May 2023 21:07:48 +0900 Subject: [PATCH 1/4] gh-104469: Convert _testcapi/long to use AC --- Modules/_testcapi/clinic/long.c.h | 149 ++++++++++++++++++++++++++++++ Modules/_testcapi/long.c | 98 +++++++++++++------- 2 files changed, 214 insertions(+), 33 deletions(-) create mode 100644 Modules/_testcapi/clinic/long.c.h diff --git a/Modules/_testcapi/clinic/long.c.h b/Modules/_testcapi/clinic/long.c.h new file mode 100644 index 00000000000000..b6e091ec8d6132 --- /dev/null +++ b/Modules/_testcapi/clinic/long.c.h @@ -0,0 +1,149 @@ +/*[clinic input] +preserve +[clinic start generated code]*/ + +#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) +# include "pycore_gc.h" // PyGC_Head +# include "pycore_runtime.h" // _Py_ID() +#endif + + +PyDoc_STRVAR(_testcapi_test_long_api__doc__, +"test_long_api($module, /)\n" +"--\n" +"\n"); + +#define _TESTCAPI_TEST_LONG_API_METHODDEF \ + {"test_long_api", (PyCFunction)_testcapi_test_long_api, METH_NOARGS, _testcapi_test_long_api__doc__}, + +static PyObject * +_testcapi_test_long_api_impl(PyObject *module); + +static PyObject * +_testcapi_test_long_api(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return _testcapi_test_long_api_impl(module); +} + +PyDoc_STRVAR(_testcapi_test_longlong_api__doc__, +"test_longlong_api($module, /)\n" +"--\n" +"\n"); + +#define _TESTCAPI_TEST_LONGLONG_API_METHODDEF \ + {"test_longlong_api", (PyCFunction)_testcapi_test_longlong_api, METH_NOARGS, _testcapi_test_longlong_api__doc__}, + +static PyObject * +_testcapi_test_longlong_api_impl(PyObject *module); + +static PyObject * +_testcapi_test_longlong_api(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return _testcapi_test_longlong_api_impl(module); +} + +PyDoc_STRVAR(_testcapi_test_long_and_overflow__doc__, +"test_long_and_overflow($module, /)\n" +"--\n" +"\n" +"Test the PyLong_AsLongAndOverflow API. General conversion to PY_LONG is tested by test_long_api_inner. This test will concentrate on proper handling of overflow."); + +#define _TESTCAPI_TEST_LONG_AND_OVERFLOW_METHODDEF \ + {"test_long_and_overflow", (PyCFunction)_testcapi_test_long_and_overflow, METH_NOARGS, _testcapi_test_long_and_overflow__doc__}, + +static PyObject * +_testcapi_test_long_and_overflow_impl(PyObject *module); + +static PyObject * +_testcapi_test_long_and_overflow(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return _testcapi_test_long_and_overflow_impl(module); +} + +PyDoc_STRVAR(_testcapi_test_long_long_and_overflow__doc__, +"test_long_long_and_overflow($module, /)\n" +"--\n" +"\n" +"Test the PyLong_AsLongLongAndOverflow API. General conversion to long long is tested by test_long_api_inner. This test will concentrate on proper handling of overflow."); + +#define _TESTCAPI_TEST_LONG_LONG_AND_OVERFLOW_METHODDEF \ + {"test_long_long_and_overflow", (PyCFunction)_testcapi_test_long_long_and_overflow, METH_NOARGS, _testcapi_test_long_long_and_overflow__doc__}, + +static PyObject * +_testcapi_test_long_long_and_overflow_impl(PyObject *module); + +static PyObject * +_testcapi_test_long_long_and_overflow(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return _testcapi_test_long_long_and_overflow_impl(module); +} + +PyDoc_STRVAR(_testcapi_test_long_as_size_t__doc__, +"test_long_as_size_t($module, /)\n" +"--\n" +"\n" +"Test the PyLong_As{Size,Ssize}_t API. At present this just tests that non-integer arguments are handled correctly. It should be extended to test overflow handling."); + +#define _TESTCAPI_TEST_LONG_AS_SIZE_T_METHODDEF \ + {"test_long_as_size_t", (PyCFunction)_testcapi_test_long_as_size_t, METH_NOARGS, _testcapi_test_long_as_size_t__doc__}, + +static PyObject * +_testcapi_test_long_as_size_t_impl(PyObject *module); + +static PyObject * +_testcapi_test_long_as_size_t(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return _testcapi_test_long_as_size_t_impl(module); +} + +PyDoc_STRVAR(_testcapi_test_long_as_unsigned_long_long_mask__doc__, +"test_long_as_unsigned_long_long_mask($module, /)\n" +"--\n" +"\n"); + +#define _TESTCAPI_TEST_LONG_AS_UNSIGNED_LONG_LONG_MASK_METHODDEF \ + {"test_long_as_unsigned_long_long_mask", (PyCFunction)_testcapi_test_long_as_unsigned_long_long_mask, METH_NOARGS, _testcapi_test_long_as_unsigned_long_long_mask__doc__}, + +static PyObject * +_testcapi_test_long_as_unsigned_long_long_mask_impl(PyObject *module); + +static PyObject * +_testcapi_test_long_as_unsigned_long_long_mask(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return _testcapi_test_long_as_unsigned_long_long_mask_impl(module); +} + +PyDoc_STRVAR(_testcapi_test_long_as_double__doc__, +"test_long_as_double($module, /)\n" +"--\n" +"\n"); + +#define _TESTCAPI_TEST_LONG_AS_DOUBLE_METHODDEF \ + {"test_long_as_double", (PyCFunction)_testcapi_test_long_as_double, METH_NOARGS, _testcapi_test_long_as_double__doc__}, + +static PyObject * +_testcapi_test_long_as_double_impl(PyObject *module); + +static PyObject * +_testcapi_test_long_as_double(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return _testcapi_test_long_as_double_impl(module); +} + +PyDoc_STRVAR(_testcapi_test_long_numbits__doc__, +"test_long_numbits($module, /)\n" +"--\n" +"\n"); + +#define _TESTCAPI_TEST_LONG_NUMBITS_METHODDEF \ + {"test_long_numbits", (PyCFunction)_testcapi_test_long_numbits, METH_NOARGS, _testcapi_test_long_numbits__doc__}, + +static PyObject * +_testcapi_test_long_numbits_impl(PyObject *module); + +static PyObject * +_testcapi_test_long_numbits(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return _testcapi_test_long_numbits_impl(module); +} +/*[clinic end generated code: output=6075a70259aaae38 input=a9049054013a1b77]*/ diff --git a/Modules/_testcapi/long.c b/Modules/_testcapi/long.c index 61dd96596dad1c..d9c09533e699a3 100644 --- a/Modules/_testcapi/long.c +++ b/Modules/_testcapi/long.c @@ -1,4 +1,10 @@ #include "parts.h" +#include "clinic/long.c.h" + +/*[clinic input] +module _testcapi +[clinic start generated code]*/ +/*[clinic end generated code: output=da39a3ee5e6b4b0d input=6361033e795369fc]*/ static PyObject * @@ -40,8 +46,13 @@ raise_test_long_error(const char* msg) #include "testcapi_long.h" +/*[clinic input] +_testcapi.test_long_api +[clinic start generated code]*/ + static PyObject * -test_long_api(PyObject* self, PyObject *Py_UNUSED(ignored)) +_testcapi_test_long_api_impl(PyObject *module) +/*[clinic end generated code: output=4405798ca1e9f444 input=e9b8880d7331c688]*/ { return TESTNAME(raise_test_long_error); } @@ -68,8 +79,13 @@ raise_test_longlong_error(const char* msg) #include "testcapi_long.h" +/*[clinic input] +_testcapi.test_longlong_api +[clinic start generated code]*/ + static PyObject * -test_longlong_api(PyObject* self, PyObject *args) +_testcapi_test_longlong_api_impl(PyObject *module) +/*[clinic end generated code: output=2b3414ba8c31dfe6 input=ccbb2a48c2b3c4a5]*/ { return TESTNAME(raise_test_longlong_error); } @@ -81,13 +97,16 @@ test_longlong_api(PyObject* self, PyObject *args) #undef F_U_TO_PY #undef F_PY_TO_U -/* Test the PyLong_AsLongAndOverflow API. General conversion to PY_LONG - is tested by test_long_api_inner. This test will concentrate on proper - handling of overflow. -*/ + +/*[clinic input] +_testcapi.test_long_and_overflow + +Test the PyLong_AsLongAndOverflow API. General conversion to PY_LONG is tested by test_long_api_inner. This test will concentrate on proper handling of overflow. +[clinic start generated code]*/ static PyObject * -test_long_and_overflow(PyObject *self, PyObject *Py_UNUSED(ignored)) +_testcapi_test_long_and_overflow_impl(PyObject *module) +/*[clinic end generated code: output=f8460ca115e31d8e input=0eec7ad657143d42]*/ { PyObject *num, *one, *temp; long value; @@ -243,13 +262,15 @@ test_long_and_overflow(PyObject *self, PyObject *Py_UNUSED(ignored)) Py_RETURN_NONE; } -/* Test the PyLong_AsLongLongAndOverflow API. General conversion to - long long is tested by test_long_api_inner. This test will - concentrate on proper handling of overflow. -*/ +/*[clinic input] +_testcapi.test_long_long_and_overflow + +Test the PyLong_AsLongLongAndOverflow API. General conversion to long long is tested by test_long_api_inner. This test will concentrate on proper handling of overflow. +[clinic start generated code]*/ static PyObject * -test_long_long_and_overflow(PyObject *self, PyObject *Py_UNUSED(ignored)) +_testcapi_test_long_long_and_overflow_impl(PyObject *module) +/*[clinic end generated code: output=0b92330786f45483 input=96dc3e6c0cdc0475]*/ { PyObject *num, *one, *temp; long long value; @@ -405,13 +426,15 @@ test_long_long_and_overflow(PyObject *self, PyObject *Py_UNUSED(ignored)) Py_RETURN_NONE; } -/* Test the PyLong_As{Size,Ssize}_t API. At present this just tests that - non-integer arguments are handled correctly. It should be extended to - test overflow handling. - */ +/*[clinic input] +_testcapi.test_long_as_size_t + +Test the PyLong_As{Size,Ssize}_t API. At present this just tests that non-integer arguments are handled correctly. It should be extended to test overflow handling. +[clinic start generated code]*/ static PyObject * -test_long_as_size_t(PyObject *self, PyObject *Py_UNUSED(ignored)) +_testcapi_test_long_as_size_t_impl(PyObject *module) +/*[clinic end generated code: output=f6490ea2b41e6173 input=47d303cdd7144351]*/ { size_t out_u; Py_ssize_t out_s; @@ -442,9 +465,13 @@ test_long_as_size_t(PyObject *self, PyObject *Py_UNUSED(ignored)) return Py_None; } +/*[clinic input] +_testcapi.test_long_as_unsigned_long_long_mask +[clinic start generated code]*/ + static PyObject * -test_long_as_unsigned_long_long_mask(PyObject *self, - PyObject *Py_UNUSED(ignored)) +_testcapi_test_long_as_unsigned_long_long_mask_impl(PyObject *module) +/*[clinic end generated code: output=e3e16cd0189440cc input=eb2438493ae7b9af]*/ { unsigned long long res = PyLong_AsUnsignedLongLongMask(NULL); @@ -462,12 +489,13 @@ test_long_as_unsigned_long_long_mask(PyObject *self, Py_RETURN_NONE; } -/* Test the PyLong_AsDouble API. At present this just tests that - non-integer arguments are handled correctly. - */ +/*[clinic input] +_testcapi.test_long_as_double +[clinic start generated code]*/ static PyObject * -test_long_as_double(PyObject *self, PyObject *Py_UNUSED(ignored)) +_testcapi_test_long_as_double_impl(PyObject *module) +/*[clinic end generated code: output=deca0898e15adde5 input=c77bc88ef5a1de76]*/ { double out; @@ -487,9 +515,13 @@ test_long_as_double(PyObject *self, PyObject *Py_UNUSED(ignored)) return Py_None; } -/* Simple test of _PyLong_NumBits and _PyLong_Sign. */ +/*[clinic input] +_testcapi.test_long_numbits +[clinic start generated code]*/ + static PyObject * -test_long_numbits(PyObject *self, PyObject *Py_UNUSED(ignored)) +_testcapi_test_long_numbits_impl(PyObject *module) +/*[clinic end generated code: output=9eaf8458cb15d7f7 input=265c02d48a13059e]*/ { struct triple { long input; @@ -547,14 +579,14 @@ check_long_compact_api(PyObject *self, PyObject *arg) } static PyMethodDef test_methods[] = { - {"test_long_and_overflow", test_long_and_overflow, METH_NOARGS}, - {"test_long_api", test_long_api, METH_NOARGS}, - {"test_long_as_double", test_long_as_double, METH_NOARGS}, - {"test_long_as_size_t", test_long_as_size_t, METH_NOARGS}, - {"test_long_as_unsigned_long_long_mask", test_long_as_unsigned_long_long_mask, METH_NOARGS}, - {"test_long_long_and_overflow",test_long_long_and_overflow, METH_NOARGS}, - {"test_long_numbits", test_long_numbits, METH_NOARGS}, - {"test_longlong_api", test_longlong_api, METH_NOARGS}, + _TESTCAPI_TEST_LONG_AND_OVERFLOW_METHODDEF + _TESTCAPI_TEST_LONG_API_METHODDEF + _TESTCAPI_TEST_LONG_AS_DOUBLE_METHODDEF + _TESTCAPI_TEST_LONG_AS_SIZE_T_METHODDEF + _TESTCAPI_TEST_LONG_AS_UNSIGNED_LONG_LONG_MASK_METHODDEF + _TESTCAPI_TEST_LONG_LONG_AND_OVERFLOW_METHODDEF + _TESTCAPI_TEST_LONG_NUMBITS_METHODDEF + _TESTCAPI_TEST_LONGLONG_API_METHODDEF {"call_long_compact_api", check_long_compact_api, METH_O}, {NULL}, }; From 5c417a64f475d55b77985bf4f7e511187e79c478 Mon Sep 17 00:00:00 2001 From: Dong-hee Na Date: Sun, 21 May 2023 23:43:05 +0900 Subject: [PATCH 2/4] Update --- Modules/_testcapi/clinic/long.c.h | 10 +++++++++- Modules/_testcapi/long.c | 12 ++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/Modules/_testcapi/clinic/long.c.h b/Modules/_testcapi/clinic/long.c.h index b6e091ec8d6132..aabf09b7ca0878 100644 --- a/Modules/_testcapi/clinic/long.c.h +++ b/Modules/_testcapi/clinic/long.c.h @@ -146,4 +146,12 @@ _testcapi_test_long_numbits(PyObject *module, PyObject *Py_UNUSED(ignored)) { return _testcapi_test_long_numbits_impl(module); } -/*[clinic end generated code: output=6075a70259aaae38 input=a9049054013a1b77]*/ + +PyDoc_STRVAR(_testcapi_call_long_compact_api__doc__, +"call_long_compact_api($module, arg, /)\n" +"--\n" +"\n"); + +#define _TESTCAPI_CALL_LONG_COMPACT_API_METHODDEF \ + {"call_long_compact_api", (PyCFunction)_testcapi_call_long_compact_api, METH_O, _testcapi_call_long_compact_api__doc__}, +/*[clinic end generated code: output=acfcbe2eea22153e input=a9049054013a1b77]*/ diff --git a/Modules/_testcapi/long.c b/Modules/_testcapi/long.c index d9c09533e699a3..f7e991f9e17055 100644 --- a/Modules/_testcapi/long.c +++ b/Modules/_testcapi/long.c @@ -566,8 +566,16 @@ _testcapi_test_long_numbits_impl(PyObject *module) Py_RETURN_NONE; } +/*[clinic input] +_testcapi.call_long_compact_api + arg: object + / +[clinic start generated code]*/ + static PyObject * -check_long_compact_api(PyObject *self, PyObject *arg) +_testcapi_call_long_compact_api(PyObject *module, PyObject *arg) +/*[clinic end generated code: output=7e3894f611b1b2b7 input=87b87396967af14c]*/ + { assert(PyLong_Check(arg)); int is_compact = PyUnstable_Long_IsCompact((PyLongObject*)arg); @@ -587,7 +595,7 @@ static PyMethodDef test_methods[] = { _TESTCAPI_TEST_LONG_LONG_AND_OVERFLOW_METHODDEF _TESTCAPI_TEST_LONG_NUMBITS_METHODDEF _TESTCAPI_TEST_LONGLONG_API_METHODDEF - {"call_long_compact_api", check_long_compact_api, METH_O}, + _TESTCAPI_CALL_LONG_COMPACT_API_METHODDEF {NULL}, }; From 081e139b6040de0a10398ddc4c7cffef8d2039f0 Mon Sep 17 00:00:00 2001 From: Dong-hee Na Date: Mon, 22 May 2023 18:04:37 +0900 Subject: [PATCH 3/4] Address code review --- Modules/_testcapi/clinic/long.c.h | 20 ++++++++++++++++---- Modules/_testcapi/long.c | 24 ++++++++++++++++++------ 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/Modules/_testcapi/clinic/long.c.h b/Modules/_testcapi/clinic/long.c.h index aabf09b7ca0878..4be3dbd9c2d14f 100644 --- a/Modules/_testcapi/clinic/long.c.h +++ b/Modules/_testcapi/clinic/long.c.h @@ -46,7 +46,11 @@ PyDoc_STRVAR(_testcapi_test_long_and_overflow__doc__, "test_long_and_overflow($module, /)\n" "--\n" "\n" -"Test the PyLong_AsLongAndOverflow API. General conversion to PY_LONG is tested by test_long_api_inner. This test will concentrate on proper handling of overflow."); +"Test the PyLong_AsLongAndOverflow API.\n" +"\n" +"General conversion to PY_LONG is tested by test_long_api_inner.\n" +"\n" +"This test will concentrate on proper handling of overflow."); #define _TESTCAPI_TEST_LONG_AND_OVERFLOW_METHODDEF \ {"test_long_and_overflow", (PyCFunction)_testcapi_test_long_and_overflow, METH_NOARGS, _testcapi_test_long_and_overflow__doc__}, @@ -64,7 +68,11 @@ PyDoc_STRVAR(_testcapi_test_long_long_and_overflow__doc__, "test_long_long_and_overflow($module, /)\n" "--\n" "\n" -"Test the PyLong_AsLongLongAndOverflow API. General conversion to long long is tested by test_long_api_inner. This test will concentrate on proper handling of overflow."); +"Test the PyLong_AsLongLongAndOverflow API.\n" +"\n" +"General conversion to long long is tested by test_long_api_inner.\n" +"\n" +"This test will concentrate on proper handling of overflow."); #define _TESTCAPI_TEST_LONG_LONG_AND_OVERFLOW_METHODDEF \ {"test_long_long_and_overflow", (PyCFunction)_testcapi_test_long_long_and_overflow, METH_NOARGS, _testcapi_test_long_long_and_overflow__doc__}, @@ -82,7 +90,11 @@ PyDoc_STRVAR(_testcapi_test_long_as_size_t__doc__, "test_long_as_size_t($module, /)\n" "--\n" "\n" -"Test the PyLong_As{Size,Ssize}_t API. At present this just tests that non-integer arguments are handled correctly. It should be extended to test overflow handling."); +"Test the PyLong_As{Size,Ssize}_t API.\n" +"\n" +"At present this just tests that non-integer arguments are handled correctly.\n" +"\n" +"It should be extended to test overflow handling."); #define _TESTCAPI_TEST_LONG_AS_SIZE_T_METHODDEF \ {"test_long_as_size_t", (PyCFunction)_testcapi_test_long_as_size_t, METH_NOARGS, _testcapi_test_long_as_size_t__doc__}, @@ -154,4 +166,4 @@ PyDoc_STRVAR(_testcapi_call_long_compact_api__doc__, #define _TESTCAPI_CALL_LONG_COMPACT_API_METHODDEF \ {"call_long_compact_api", (PyCFunction)_testcapi_call_long_compact_api, METH_O, _testcapi_call_long_compact_api__doc__}, -/*[clinic end generated code: output=acfcbe2eea22153e input=a9049054013a1b77]*/ +/*[clinic end generated code: output=5169034598a55388 input=a9049054013a1b77]*/ diff --git a/Modules/_testcapi/long.c b/Modules/_testcapi/long.c index f7e991f9e17055..0c96fc0959c748 100644 --- a/Modules/_testcapi/long.c +++ b/Modules/_testcapi/long.c @@ -101,12 +101,16 @@ _testcapi_test_longlong_api_impl(PyObject *module) /*[clinic input] _testcapi.test_long_and_overflow -Test the PyLong_AsLongAndOverflow API. General conversion to PY_LONG is tested by test_long_api_inner. This test will concentrate on proper handling of overflow. +Test the PyLong_AsLongAndOverflow API. + +General conversion to PY_LONG is tested by test_long_api_inner. + +This test will concentrate on proper handling of overflow. [clinic start generated code]*/ static PyObject * _testcapi_test_long_and_overflow_impl(PyObject *module) -/*[clinic end generated code: output=f8460ca115e31d8e input=0eec7ad657143d42]*/ +/*[clinic end generated code: output=f8460ca115e31d8e input=8e7eb2d3401c8623]*/ { PyObject *num, *one, *temp; long value; @@ -265,12 +269,16 @@ _testcapi_test_long_and_overflow_impl(PyObject *module) /*[clinic input] _testcapi.test_long_long_and_overflow -Test the PyLong_AsLongLongAndOverflow API. General conversion to long long is tested by test_long_api_inner. This test will concentrate on proper handling of overflow. +Test the PyLong_AsLongLongAndOverflow API. + +General conversion to long long is tested by test_long_api_inner. + +This test will concentrate on proper handling of overflow. [clinic start generated code]*/ static PyObject * _testcapi_test_long_long_and_overflow_impl(PyObject *module) -/*[clinic end generated code: output=0b92330786f45483 input=96dc3e6c0cdc0475]*/ +/*[clinic end generated code: output=0b92330786f45483 input=2496093514367165]*/ { PyObject *num, *one, *temp; long long value; @@ -429,12 +437,16 @@ _testcapi_test_long_long_and_overflow_impl(PyObject *module) /*[clinic input] _testcapi.test_long_as_size_t -Test the PyLong_As{Size,Ssize}_t API. At present this just tests that non-integer arguments are handled correctly. It should be extended to test overflow handling. +Test the PyLong_As{Size,Ssize}_t API. + +At present this just tests that non-integer arguments are handled correctly. + +It should be extended to test overflow handling. [clinic start generated code]*/ static PyObject * _testcapi_test_long_as_size_t_impl(PyObject *module) -/*[clinic end generated code: output=f6490ea2b41e6173 input=47d303cdd7144351]*/ +/*[clinic end generated code: output=f6490ea2b41e6173 input=4d2aafa054f3f9b4]*/ { size_t out_u; Py_ssize_t out_s; From 48c366b1fd39dd51f4a18b8e60de229ac06b8db3 Mon Sep 17 00:00:00 2001 From: Dong-hee Na Date: Mon, 22 May 2023 23:06:15 +0900 Subject: [PATCH 4/4] update --- Modules/_testcapi/clinic/long.c.h | 5 +---- Modules/_testcapi/long.c | 9 +++------ 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/Modules/_testcapi/clinic/long.c.h b/Modules/_testcapi/clinic/long.c.h index 4be3dbd9c2d14f..95885e0ae17a6c 100644 --- a/Modules/_testcapi/clinic/long.c.h +++ b/Modules/_testcapi/clinic/long.c.h @@ -49,7 +49,6 @@ PyDoc_STRVAR(_testcapi_test_long_and_overflow__doc__, "Test the PyLong_AsLongAndOverflow API.\n" "\n" "General conversion to PY_LONG is tested by test_long_api_inner.\n" -"\n" "This test will concentrate on proper handling of overflow."); #define _TESTCAPI_TEST_LONG_AND_OVERFLOW_METHODDEF \ @@ -71,7 +70,6 @@ PyDoc_STRVAR(_testcapi_test_long_long_and_overflow__doc__, "Test the PyLong_AsLongLongAndOverflow API.\n" "\n" "General conversion to long long is tested by test_long_api_inner.\n" -"\n" "This test will concentrate on proper handling of overflow."); #define _TESTCAPI_TEST_LONG_LONG_AND_OVERFLOW_METHODDEF \ @@ -93,7 +91,6 @@ PyDoc_STRVAR(_testcapi_test_long_as_size_t__doc__, "Test the PyLong_As{Size,Ssize}_t API.\n" "\n" "At present this just tests that non-integer arguments are handled correctly.\n" -"\n" "It should be extended to test overflow handling."); #define _TESTCAPI_TEST_LONG_AS_SIZE_T_METHODDEF \ @@ -166,4 +163,4 @@ PyDoc_STRVAR(_testcapi_call_long_compact_api__doc__, #define _TESTCAPI_CALL_LONG_COMPACT_API_METHODDEF \ {"call_long_compact_api", (PyCFunction)_testcapi_call_long_compact_api, METH_O, _testcapi_call_long_compact_api__doc__}, -/*[clinic end generated code: output=5169034598a55388 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=d000a1b58fa81eab input=a9049054013a1b77]*/ diff --git a/Modules/_testcapi/long.c b/Modules/_testcapi/long.c index 0c96fc0959c748..ede43f60d06f95 100644 --- a/Modules/_testcapi/long.c +++ b/Modules/_testcapi/long.c @@ -104,13 +104,12 @@ _testcapi.test_long_and_overflow Test the PyLong_AsLongAndOverflow API. General conversion to PY_LONG is tested by test_long_api_inner. - This test will concentrate on proper handling of overflow. [clinic start generated code]*/ static PyObject * _testcapi_test_long_and_overflow_impl(PyObject *module) -/*[clinic end generated code: output=f8460ca115e31d8e input=8e7eb2d3401c8623]*/ +/*[clinic end generated code: output=f8460ca115e31d8e input=762f6b62da0a3cdc]*/ { PyObject *num, *one, *temp; long value; @@ -272,13 +271,12 @@ _testcapi.test_long_long_and_overflow Test the PyLong_AsLongLongAndOverflow API. General conversion to long long is tested by test_long_api_inner. - This test will concentrate on proper handling of overflow. [clinic start generated code]*/ static PyObject * _testcapi_test_long_long_and_overflow_impl(PyObject *module) -/*[clinic end generated code: output=0b92330786f45483 input=2496093514367165]*/ +/*[clinic end generated code: output=0b92330786f45483 input=544bb0aefe5e8a9e]*/ { PyObject *num, *one, *temp; long long value; @@ -440,13 +438,12 @@ _testcapi.test_long_as_size_t Test the PyLong_As{Size,Ssize}_t API. At present this just tests that non-integer arguments are handled correctly. - It should be extended to test overflow handling. [clinic start generated code]*/ static PyObject * _testcapi_test_long_as_size_t_impl(PyObject *module) -/*[clinic end generated code: output=f6490ea2b41e6173 input=4d2aafa054f3f9b4]*/ +/*[clinic end generated code: output=f6490ea2b41e6173 input=922990c4a3edfb0d]*/ { size_t out_u; Py_ssize_t out_s;