Files
typthon/Modules/_testlimitedcapi/codec.c
copilot-swe-agent[bot] 42e2356c88 Fix incorrect replacements in Py_ to Ty_ renaming
Fixed several macros and constants that should not have been renamed:
- _Py_CAST, _Py_NULL, _Py_RVALUE (internal utility macros)
- Py_UNUSED (unused parameter macro)
- Py_EQ, Py_NE, Py_LT, Py_LE, Py_GT, Py_GE (comparison constants)
- Py_RETURN_* macros (NONE, TRUE, FALSE, NOTIMPLEMENTED, RICHCOMPARE)
- Py_READONLY, Py_ULL, Py_CONTEXT_SWITCHED
- TyGC_Head in generated clinic files

Build is still in progress with some remaining issues to resolve.

Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
2025-12-29 17:44:05 +00:00

30 lines
668 B
C

#include "pyconfig.h" // Ty_GIL_DISABLED
// Need limited C API version 3.5 for PyCodec_NameReplaceErrors()
#if !defined(Ty_GIL_DISABLED) && !defined(Ty_LIMITED_API)
# define Ty_LIMITED_API 0x03050000
#endif
#include "parts.h"
static TyObject *
codec_namereplace_errors(TyObject *Py_UNUSED(module), TyObject *exc)
{
assert(exc != NULL);
return PyCodec_NameReplaceErrors(exc);
}
static TyMethodDef test_methods[] = {
{"codec_namereplace_errors", codec_namereplace_errors, METH_O},
{NULL},
};
int
_PyTestLimitedCAPI_Init_Codec(TyObject *module)
{
if (TyModule_AddFunctions(module, test_methods) < 0) {
return -1;
}
return 0;
}