| 1 |
#include "pyconfig.h" // Py_GIL_DISABLED |
| 2 |
|
| 3 |
// Need limited C API version 3.5 for PyCodec_NameReplaceErrors() |
| 4 |
#if !defined(Py_GIL_DISABLED) && !defined(Py_LIMITED_API) |
| 5 |
# define Py_LIMITED_API 0x03050000 |
| 6 |
#endif |
| 7 |
|
| 8 |
#include "parts.h" |
| 9 |
|
| 10 |
static PyObject * |
| 11 |
codec_namereplace_errors(PyObject *Py_UNUSED(module), PyObject *exc) |
| 12 |
{ |
| 13 |
assert(exc != NULL); |
| 14 |
return PyCodec_NameReplaceErrors(exc); |
| 15 |
} |
| 16 |
|
| 17 |
static PyMethodDef test_methods[] = { |
| 18 |
{"codec_namereplace_errors", codec_namereplace_errors, METH_O}, |
| 19 |
{NULL}, |
| 20 |
}; |
| 21 |
|
| 22 |
int |
| 23 |
_PyTestLimitedCAPI_Init_Codec(PyObject *module) |
| 24 |
{ |
| 25 |
if (PyModule_AddFunctions(module, test_methods) < 0) { |
| 26 |
return -1; |
| 27 |
} |
| 28 |
return 0; |
| 29 |
} |