// clinic/exceptions.c.h uses internal pycore_modsupport.h API #define PYTESTCAPI_NEED_INTERNAL_API #include "parts.h" #include "util.h" #include "clinic/exceptions.c.h" /*[clinic input] module _testcapi [clinic start generated code]*/ /*[clinic end generated code: output=da39a3ee5e6b4b0d input=6361033e795369fc]*/ /*[clinic input] _testcapi.err_set_raised exception as exc: object / [clinic start generated code]*/ static PyObject * _testcapi_err_set_raised(PyObject *module, PyObject *exc) /*[clinic end generated code: output=0a0c7743961fcae5 input=c5f7331864a94df9]*/ { … } static PyObject * err_restore(PyObject *self, PyObject *args) { … } /*[clinic input] _testcapi.exception_print exception as exc: object legacy: bool = False / To test the format of exceptions as printed out. [clinic start generated code]*/ static PyObject * _testcapi_exception_print_impl(PyObject *module, PyObject *exc, int legacy) /*[clinic end generated code: output=3f04fe0c18412ae0 input=c76f42cb94136dbf]*/ { … } /*[clinic input] _testcapi.make_exception_with_doc name: str doc: str = NULL base: object = NULL dict: object = NULL Test PyErr_NewExceptionWithDoc (also exercise PyErr_NewException). Run via Lib/test/test_exceptions.py [clinic start generated code]*/ static PyObject * _testcapi_make_exception_with_doc_impl(PyObject *module, const char *name, const char *doc, PyObject *base, PyObject *dict) /*[clinic end generated code: output=439f0d963c1ce2c4 input=23a73013f8a8795a]*/ { … } /*[clinic input] _testcapi.exc_set_object exception as exc: object obj: object / [clinic start generated code]*/ static PyObject * _testcapi_exc_set_object_impl(PyObject *module, PyObject *exc, PyObject *obj) /*[clinic end generated code: output=34c8c7c83e5c8463 input=fc530aafb1b0a360]*/ { … } /*[clinic input] _testcapi.exc_set_object_fetch = _testcapi.exc_set_object [clinic start generated code]*/ static PyObject * _testcapi_exc_set_object_fetch_impl(PyObject *module, PyObject *exc, PyObject *obj) /*[clinic end generated code: output=7a5ff5f6d3cf687f input=77ec686f1f95fa38]*/ { … } /*[clinic input] _testcapi.err_setstring exc: object value: str(zeroes=True, accept={robuffer, str, NoneType}) / [clinic start generated code]*/ static PyObject * _testcapi_err_setstring_impl(PyObject *module, PyObject *exc, const char *value, Py_ssize_t value_length) /*[clinic end generated code: output=fba8705e5703dd3f input=e8a95fad66d9004b]*/ { … } /*[clinic input] _testcapi.err_setfromerrnowithfilename error: int exc: object value: str(zeroes=True, accept={robuffer, str, NoneType}) / [clinic start generated code]*/ static PyObject * _testcapi_err_setfromerrnowithfilename_impl(PyObject *module, int error, PyObject *exc, const char *value, Py_ssize_t value_length) /*[clinic end generated code: output=d02df5749a01850e input=ff7c384234bf097f]*/ { … } /*[clinic input] _testcapi.raise_exception exception as exc: object num_args: int / [clinic start generated code]*/ static PyObject * _testcapi_raise_exception_impl(PyObject *module, PyObject *exc, int num_args) /*[clinic end generated code: output=eb0a9c5d69e0542d input=83d6262c3829d088]*/ { … } /*[clinic input] _testcapi.raise_memoryerror [clinic start generated code]*/ static PyObject * _testcapi_raise_memoryerror_impl(PyObject *module) /*[clinic end generated code: output=dd057803fb0131e6 input=6ca521bd07fb73cb]*/ { … } /*[clinic input] _testcapi.fatal_error message: str(accept={robuffer}) release_gil: bool = False / [clinic start generated code]*/ static PyObject * _testcapi_fatal_error_impl(PyObject *module, const char *message, int release_gil) /*[clinic end generated code: output=9c3237116e6a03e8 input=1be357a2ccb04c8c]*/ { … } /*[clinic input] _testcapi.set_exc_info new_type: object new_value: object new_tb: object / [clinic start generated code]*/ static PyObject * _testcapi_set_exc_info_impl(PyObject *module, PyObject *new_type, PyObject *new_value, PyObject *new_tb) /*[clinic end generated code: output=b55fa35dec31300e input=ea9f19e0f55fe5b3]*/ { … } /*[clinic input] _testcapi.set_exception new_exc: object / [clinic start generated code]*/ static PyObject * _testcapi_set_exception(PyObject *module, PyObject *new_exc) /*[clinic end generated code: output=8b969b35d029e96d input=c89d4ca966c69738]*/ { … } /*[clinic input] _testcapi.traceback_print traceback: object file: object / To test the format of tracebacks as printed out. [clinic start generated code]*/ static PyObject * _testcapi_traceback_print_impl(PyObject *module, PyObject *traceback, PyObject *file) /*[clinic end generated code: output=17074ecf9d95cf30 input=9423f2857b008ca8]*/ { … } static PyObject * err_writeunraisable(PyObject *Py_UNUSED(module), PyObject *args) { … } static PyObject * err_formatunraisable(PyObject *Py_UNUSED(module), PyObject *args) { … } /*[clinic input] _testcapi.unstable_exc_prep_reraise_star orig: object excs: object / To test PyUnstable_Exc_PrepReraiseStar. [clinic start generated code]*/ static PyObject * _testcapi_unstable_exc_prep_reraise_star_impl(PyObject *module, PyObject *orig, PyObject *excs) /*[clinic end generated code: output=850cf008e0563c77 input=27fbcda2203eb301]*/ { … } /* * Define the PyRecurdingInfinitelyError_Type */ static PyTypeObject PyRecursingInfinitelyError_Type; static int recurse_infinitely_error_init(PyObject *self, PyObject *args, PyObject *kwds) { … } static PyTypeObject PyRecursingInfinitelyError_Type = …; static PyMethodDef test_methods[] = …; int _PyTestCapi_Init_Exceptions(PyObject *mod) { … }