diff options
Diffstat (limited to 'Modules/_testcapimodule.c')
-rw-r--r-- | Modules/_testcapimodule.c | 147 |
1 files changed, 71 insertions, 76 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index afce6c9..0e48463 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -51,7 +51,7 @@ sizeof_error(const char* fatname, const char* typname, } static PyObject* -test_config(PyObject *self) +test_config(PyObject *self, PyObject *Py_UNUSED(ignored)) { #define CHECK_SIZEOF(FATNAME, TYPE) \ if (FATNAME != sizeof(TYPE)) \ @@ -70,7 +70,7 @@ test_config(PyObject *self) } static PyObject* -test_sizeof_c_types(PyObject *self) +test_sizeof_c_types(PyObject *self, PyObject *Py_UNUSED(ignored)) { #if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 5))) #pragma GCC diagnostic push @@ -131,7 +131,7 @@ test_sizeof_c_types(PyObject *self) static PyObject* -test_list_api(PyObject *self) +test_list_api(PyObject *self, PyObject *Py_UNUSED(ignored)) { PyObject* list; int i; @@ -223,7 +223,7 @@ test_dict_inner(int count) } static PyObject* -test_dict_iteration(PyObject* self) +test_dict_iteration(PyObject* self, PyObject *Py_UNUSED(ignored)) { int i; @@ -315,7 +315,7 @@ static PyTypeObject _HashInheritanceTester_Type = { }; static PyObject* -test_lazy_hash_inheritance(PyObject* self) +test_lazy_hash_inheritance(PyObject* self, PyObject *Py_UNUSED(ignored)) { PyTypeObject *type; PyObject *obj; @@ -411,7 +411,7 @@ raise_test_long_error(const char* msg) #include "testcapi_long.h" static PyObject * -test_long_api(PyObject* self) +test_long_api(PyObject* self, PyObject *Py_UNUSED(ignored)) { return TESTNAME(raise_test_long_error); } @@ -457,7 +457,7 @@ test_longlong_api(PyObject* self, PyObject *args) */ static PyObject * -test_long_and_overflow(PyObject *self) +test_long_and_overflow(PyObject *self, PyObject *Py_UNUSED(ignored)) { PyObject *num, *one, *temp; long value; @@ -621,7 +621,7 @@ test_long_and_overflow(PyObject *self) */ static PyObject * -test_long_long_and_overflow(PyObject *self) +test_long_long_and_overflow(PyObject *self, PyObject *Py_UNUSED(ignored)) { PyObject *num, *one, *temp; long long value; @@ -785,7 +785,7 @@ test_long_long_and_overflow(PyObject *self) */ static PyObject * -test_long_as_size_t(PyObject *self) +test_long_as_size_t(PyObject *self, PyObject *Py_UNUSED(ignored)) { size_t out_u; Py_ssize_t out_s; @@ -821,7 +821,7 @@ test_long_as_size_t(PyObject *self) */ static PyObject * -test_long_as_double(PyObject *self) +test_long_as_double(PyObject *self, PyObject *Py_UNUSED(ignored)) { double out; @@ -846,7 +846,7 @@ test_long_as_double(PyObject *self) it fails. */ static PyObject * -test_L_code(PyObject *self) +test_L_code(PyObject *self, PyObject *Py_UNUSED(ignored)) { PyObject *tuple, *num; long long value; @@ -1173,7 +1173,7 @@ getargs_K(PyObject *self, PyObject *args) /* This function not only tests the 'k' getargs code, but also the PyLong_AsUnsignedLongMask() function. */ static PyObject * -test_k_code(PyObject *self) +test_k_code(PyObject *self, PyObject *Py_UNUSED(ignored)) { PyObject *tuple, *num; unsigned long value; @@ -1531,7 +1531,7 @@ getargs_et_hash(PyObject *self, PyObject *args) /* Test the s and z codes for PyArg_ParseTuple. */ static PyObject * -test_s_code(PyObject *self) +test_s_code(PyObject *self, PyObject *Py_UNUSED(ignored)) { /* Unicode strings should be accepted */ PyObject *tuple, *obj; @@ -1637,7 +1637,7 @@ static volatile int x; of an error. */ static PyObject * -test_u_code(PyObject *self) +test_u_code(PyObject *self, PyObject *Py_UNUSED(ignored)) { PyObject *tuple, *obj; Py_UNICODE *value; @@ -1680,7 +1680,7 @@ test_u_code(PyObject *self) /* Test Z and Z# codes for PyArg_ParseTuple */ static PyObject * -test_Z_code(PyObject *self) +test_Z_code(PyObject *self, PyObject *Py_UNUSED(ignored)) { PyObject *tuple, *obj; const Py_UNICODE *value1, *value2; @@ -1735,7 +1735,7 @@ test_Z_code(PyObject *self) } static PyObject * -test_widechar(PyObject *self) +test_widechar(PyObject *self, PyObject *Py_UNUSED(ignored)) { #if defined(SIZEOF_WCHAR_T) && (SIZEOF_WCHAR_T == 4) const wchar_t wtext[2] = {(wchar_t)0x10ABCDu}; @@ -2033,7 +2033,7 @@ getargs_w_star(PyObject *self, PyObject *args) static PyObject * -test_empty_argparse(PyObject *self) +test_empty_argparse(PyObject *self, PyObject *Py_UNUSED(ignored)) { /* Test that formats can begin with '|'. See issue #4720. */ PyObject *tuple, *dict = NULL; @@ -2083,7 +2083,7 @@ codec_incrementaldecoder(PyObject *self, PyObject *args) /* Simple test of _PyLong_NumBits and _PyLong_Sign. */ static PyObject * -test_long_numbits(PyObject *self) +test_long_numbits(PyObject *self, PyObject *Py_UNUSED(ignored)) { struct triple { long input; @@ -2131,7 +2131,7 @@ test_long_numbits(PyObject *self) /* Example passing NULLs to PyObject_Str(NULL). */ static PyObject * -test_null_strings(PyObject *self) +test_null_strings(PyObject *self, PyObject *Py_UNUSED(ignored)) { PyObject *o1 = PyObject_Str(NULL), *o2 = PyObject_Str(NULL); PyObject *tuple = PyTuple_Pack(2, o1, o2); @@ -2492,7 +2492,7 @@ test_string_from_format(PyObject *self, PyObject *args) static PyObject * -test_unicode_compare_with_ascii(PyObject *self) { +test_unicode_compare_with_ascii(PyObject *self, PyObject *Py_UNUSED(ignored)) { PyObject *py_s = PyUnicode_FromStringAndSize("str\0", 4); int result; if (py_s == NULL) @@ -2509,14 +2509,14 @@ test_unicode_compare_with_ascii(PyObject *self) { /* This is here to provide a docstring for test_descr. */ static PyObject * -test_with_docstring(PyObject *self) +test_with_docstring(PyObject *self, PyObject *Py_UNUSED(ignored)) { Py_RETURN_NONE; } /* Test PyOS_string_to_double. */ static PyObject * -test_string_to_double(PyObject *self) { +test_string_to_double(PyObject *self, PyObject *Py_UNUSED(ignored)) { double result; const char *msg; @@ -2881,7 +2881,7 @@ exception_print(PyObject *self, PyObject *args) /* reliably raise a MemoryError */ static PyObject * -raise_memoryerror(PyObject *self) +raise_memoryerror(PyObject *self, PyObject *Py_UNUSED(ignored)) { PyErr_NoMemory(); return NULL; @@ -2954,7 +2954,7 @@ make_exception_with_doc(PyObject *self, PyObject *args, PyObject *kwargs) } static PyObject * -make_memoryview_from_NULL_pointer(PyObject *self) +make_memoryview_from_NULL_pointer(PyObject *self, PyObject *Py_UNUSED(ignored)) { Py_buffer info; if (PyBuffer_FillInfo(&info, NULL, NULL, 1, 1, PyBUF_FULL_RO) < 0) @@ -3067,7 +3067,7 @@ getbuffer_with_null_view(PyObject* self, PyObject *obj) /* Test that the fatal error from not having a current thread doesn't cause an infinite loop. Run via Lib/test/test_capi.py */ static PyObject * -crash_no_current_thread(PyObject *self) +crash_no_current_thread(PyObject *self, PyObject *Py_UNUSED(ignored)) { Py_BEGIN_ALLOW_THREADS /* Using PyThreadState_Get() directly allows the test to pass in @@ -3274,7 +3274,7 @@ _test_incref(PyObject *ob) } static PyObject * -test_xincref_doesnt_leak(PyObject *ob) +test_xincref_doesnt_leak(PyObject *ob, PyObject *Py_UNUSED(ignored)) { PyObject *obj = PyLong_FromLong(0); Py_XINCREF(_test_incref(obj)); @@ -3285,7 +3285,7 @@ test_xincref_doesnt_leak(PyObject *ob) } static PyObject * -test_incref_doesnt_leak(PyObject *ob) +test_incref_doesnt_leak(PyObject *ob, PyObject *Py_UNUSED(ignored)) { PyObject *obj = PyLong_FromLong(0); Py_INCREF(_test_incref(obj)); @@ -3296,21 +3296,21 @@ test_incref_doesnt_leak(PyObject *ob) } static PyObject * -test_xdecref_doesnt_leak(PyObject *ob) +test_xdecref_doesnt_leak(PyObject *ob, PyObject *Py_UNUSED(ignored)) { Py_XDECREF(PyLong_FromLong(0)); Py_RETURN_NONE; } static PyObject * -test_decref_doesnt_leak(PyObject *ob) +test_decref_doesnt_leak(PyObject *ob, PyObject *Py_UNUSED(ignored)) { Py_DECREF(PyLong_FromLong(0)); Py_RETURN_NONE; } static PyObject * -test_incref_decref_API(PyObject *ob) +test_incref_decref_API(PyObject *ob, PyObject *Py_UNUSED(ignored)) { PyObject *obj = PyLong_FromLong(0); Py_IncRef(obj); @@ -3320,7 +3320,7 @@ test_incref_decref_API(PyObject *ob) } static PyObject * -test_pymem_alloc0(PyObject *self) +test_pymem_alloc0(PyObject *self, PyObject *Py_UNUSED(ignored)) { void *ptr; @@ -3546,19 +3546,19 @@ finally: } static PyObject * -test_pymem_setrawallocators(PyObject *self) +test_pymem_setrawallocators(PyObject *self, PyObject *Py_UNUSED(ignored)) { return test_setallocators(PYMEM_DOMAIN_RAW); } static PyObject * -test_pymem_setallocators(PyObject *self) +test_pymem_setallocators(PyObject *self, PyObject *Py_UNUSED(ignored)) { return test_setallocators(PYMEM_DOMAIN_MEM); } static PyObject * -test_pyobject_setallocators(PyObject *self) +test_pyobject_setallocators(PyObject *self, PyObject *Py_UNUSED(ignored)) { return test_setallocators(PYMEM_DOMAIN_OBJ); } @@ -3681,7 +3681,7 @@ set_nomemory(PyObject *self, PyObject *args) } static PyObject* -remove_mem_hooks(PyObject *self) +remove_mem_hooks(PyObject *self, PyObject *Py_UNUSED(ignored)) { fm_remove_hooks(); Py_RETURN_NONE; @@ -4552,10 +4552,10 @@ new_hamt(PyObject *self, PyObject *args) static PyMethodDef TestMethods[] = { {"raise_exception", raise_exception, METH_VARARGS}, - {"raise_memoryerror", (PyCFunction)raise_memoryerror, METH_NOARGS}, + {"raise_memoryerror", raise_memoryerror, METH_NOARGS}, {"set_errno", set_errno, METH_VARARGS}, - {"test_config", (PyCFunction)test_config, METH_NOARGS}, - {"test_sizeof_c_types", (PyCFunction)test_sizeof_c_types, METH_NOARGS}, + {"test_config", test_config, METH_NOARGS}, + {"test_sizeof_c_types", test_sizeof_c_types, METH_NOARGS}, {"test_datetime_capi", test_datetime_capi, METH_NOARGS}, {"datetime_check_date", datetime_check_date, METH_VARARGS}, {"datetime_check_time", datetime_check_time, METH_VARARGS}, @@ -4565,31 +4565,31 @@ static PyMethodDef TestMethods[] = { {"make_timezones_capi", make_timezones_capi, METH_NOARGS}, {"get_timezones_offset_zero", get_timezones_offset_zero, METH_NOARGS}, {"get_timezone_utc_capi", get_timezone_utc_capi, METH_VARARGS}, - {"test_list_api", (PyCFunction)test_list_api, METH_NOARGS}, - {"test_dict_iteration", (PyCFunction)test_dict_iteration,METH_NOARGS}, + {"test_list_api", test_list_api, METH_NOARGS}, + {"test_dict_iteration", test_dict_iteration, METH_NOARGS}, {"dict_getitem_knownhash", dict_getitem_knownhash, METH_VARARGS}, {"dict_hassplittable", dict_hassplittable, METH_O}, - {"test_lazy_hash_inheritance", (PyCFunction)test_lazy_hash_inheritance,METH_NOARGS}, - {"test_long_api", (PyCFunction)test_long_api, METH_NOARGS}, - {"test_xincref_doesnt_leak",(PyCFunction)test_xincref_doesnt_leak, METH_NOARGS}, - {"test_incref_doesnt_leak", (PyCFunction)test_incref_doesnt_leak, METH_NOARGS}, - {"test_xdecref_doesnt_leak",(PyCFunction)test_xdecref_doesnt_leak, METH_NOARGS}, - {"test_decref_doesnt_leak", (PyCFunction)test_decref_doesnt_leak, METH_NOARGS}, - {"test_incref_decref_API", (PyCFunction)test_incref_decref_API, METH_NOARGS}, - {"test_long_and_overflow", (PyCFunction)test_long_and_overflow, - METH_NOARGS}, - {"test_long_as_double", (PyCFunction)test_long_as_double,METH_NOARGS}, - {"test_long_as_size_t", (PyCFunction)test_long_as_size_t,METH_NOARGS}, - {"test_long_numbits", (PyCFunction)test_long_numbits, METH_NOARGS}, - {"test_k_code", (PyCFunction)test_k_code, METH_NOARGS}, - {"test_empty_argparse", (PyCFunction)test_empty_argparse,METH_NOARGS}, + {"test_lazy_hash_inheritance", test_lazy_hash_inheritance,METH_NOARGS}, + {"test_long_api", test_long_api, METH_NOARGS}, + {"test_xincref_doesnt_leak",test_xincref_doesnt_leak, METH_NOARGS}, + {"test_incref_doesnt_leak", test_incref_doesnt_leak, METH_NOARGS}, + {"test_xdecref_doesnt_leak",test_xdecref_doesnt_leak, METH_NOARGS}, + {"test_decref_doesnt_leak", test_decref_doesnt_leak, METH_NOARGS}, + {"test_incref_decref_API", test_incref_decref_API, METH_NOARGS}, + {"test_long_and_overflow", test_long_and_overflow, 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_numbits", test_long_numbits, METH_NOARGS}, + {"test_k_code", test_k_code, METH_NOARGS}, + {"test_empty_argparse", test_empty_argparse, METH_NOARGS}, {"parse_tuple_and_keywords", parse_tuple_and_keywords, METH_VARARGS}, - {"test_null_strings", (PyCFunction)test_null_strings, METH_NOARGS}, + {"test_null_strings", test_null_strings, METH_NOARGS}, {"test_string_from_format", (PyCFunction)test_string_from_format, METH_NOARGS}, - {"test_with_docstring", (PyCFunction)test_with_docstring, METH_NOARGS, + {"test_with_docstring", test_with_docstring, METH_NOARGS, PyDoc_STR("This is a pretty normal docstring.")}, - {"test_string_to_double", (PyCFunction)test_string_to_double, METH_NOARGS}, - {"test_unicode_compare_with_ascii", (PyCFunction)test_unicode_compare_with_ascii, METH_NOARGS}, + {"test_string_to_double", test_string_to_double, METH_NOARGS}, + {"test_unicode_compare_with_ascii", test_unicode_compare_with_ascii, + METH_NOARGS}, {"test_capsule", (PyCFunction)test_capsule, METH_NOARGS}, {"test_from_contiguous", (PyCFunction)test_from_contiguous, METH_NOARGS}, #if (defined(__linux__) || defined(__FreeBSD__)) && defined(__GNUC__) @@ -4620,9 +4620,8 @@ static PyMethodDef TestMethods[] = { {"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}, + {"test_long_long_and_overflow",test_long_long_and_overflow, METH_NOARGS}, + {"test_L_code", test_L_code, METH_NOARGS}, {"getargs_f", getargs_f, METH_VARARGS}, {"getargs_d", getargs_d, METH_VARARGS}, {"getargs_D", getargs_D, METH_VARARGS}, @@ -4653,10 +4652,10 @@ static PyMethodDef TestMethods[] = { (PyCFunction)codec_incrementalencoder, METH_VARARGS}, {"codec_incrementaldecoder", (PyCFunction)codec_incrementaldecoder, METH_VARARGS}, - {"test_s_code", (PyCFunction)test_s_code, METH_NOARGS}, - {"test_u_code", (PyCFunction)test_u_code, METH_NOARGS}, - {"test_Z_code", (PyCFunction)test_Z_code, METH_NOARGS}, - {"test_widechar", (PyCFunction)test_widechar, METH_NOARGS}, + {"test_s_code", test_s_code, METH_NOARGS}, + {"test_u_code", test_u_code, METH_NOARGS}, + {"test_Z_code", test_Z_code, METH_NOARGS}, + {"test_widechar", test_widechar, METH_NOARGS}, {"unicode_aswidechar", unicode_aswidechar, METH_VARARGS}, {"unicode_aswidecharstring",unicode_aswidecharstring, METH_VARARGS}, {"unicode_asucs4", unicode_asucs4, METH_VARARGS}, @@ -4677,26 +4676,22 @@ static PyMethodDef TestMethods[] = { {"code_newempty", code_newempty, METH_VARARGS}, {"make_exception_with_doc", (PyCFunction)make_exception_with_doc, METH_VARARGS | METH_KEYWORDS}, - {"make_memoryview_from_NULL_pointer", (PyCFunction)make_memoryview_from_NULL_pointer, + {"make_memoryview_from_NULL_pointer", make_memoryview_from_NULL_pointer, METH_NOARGS}, - {"crash_no_current_thread", (PyCFunction)crash_no_current_thread, METH_NOARGS}, + {"crash_no_current_thread", crash_no_current_thread, METH_NOARGS}, {"run_in_subinterp", run_in_subinterp, METH_VARARGS}, {"pytime_object_to_time_t", test_pytime_object_to_time_t, METH_VARARGS}, {"pytime_object_to_timeval", test_pytime_object_to_timeval, METH_VARARGS}, {"pytime_object_to_timespec", test_pytime_object_to_timespec, METH_VARARGS}, {"with_tp_del", with_tp_del, METH_VARARGS}, {"create_cfunction", create_cfunction, METH_NOARGS}, - {"test_pymem_alloc0", - (PyCFunction)test_pymem_alloc0, METH_NOARGS}, - {"test_pymem_setrawallocators", - (PyCFunction)test_pymem_setrawallocators, METH_NOARGS}, - {"test_pymem_setallocators", - (PyCFunction)test_pymem_setallocators, METH_NOARGS}, - {"test_pyobject_setallocators", - (PyCFunction)test_pyobject_setallocators, METH_NOARGS}, + {"test_pymem_alloc0", test_pymem_alloc0, METH_NOARGS}, + {"test_pymem_setrawallocators",test_pymem_setrawallocators, METH_NOARGS}, + {"test_pymem_setallocators",test_pymem_setallocators, METH_NOARGS}, + {"test_pyobject_setallocators",test_pyobject_setallocators, METH_NOARGS}, {"set_nomemory", (PyCFunction)set_nomemory, METH_VARARGS, PyDoc_STR("set_nomemory(start:int, stop:int = 0)")}, - {"remove_mem_hooks", (PyCFunction)remove_mem_hooks, METH_NOARGS, + {"remove_mem_hooks", remove_mem_hooks, METH_NOARGS, PyDoc_STR("Remove memory hooks.")}, {"no_docstring", (PyCFunction)test_with_docstring, METH_NOARGS}, |