Files
typthon/Modules/_testcapi/import.c
copilot-swe-agent[bot] b198f511d2 Rename Py_ to Ty_ throughout C API
Massive automated renaming of all Py_/PyObject/etc. prefixes to Ty_/TyObject/etc.
This includes:
- All public API types (TyObject, TyTypeObject, etc.)
- All public API functions (Ty_Initialize, Ty_BuildValue, etc.)
- All internal API (_Ty_ prefixes)
- Reference counting macros (Ty_INCREF, Ty_DECREF, etc.)
- Type flags (Ty_TPFLAGS_*)
- Debug flags (Ty_DEBUG, Ty_TRACE_REFS, etc.)
- All object type APIs (TyList_, TyDict_, TyUnicode_, etc.)

This changes over 60,000 occurrences across 1000+ files.

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

45 lines
1.0 KiB
C

#include "parts.h"
#include "util.h"
// Test TyImport_ImportModuleAttr()
static TyObject *
pyimport_importmoduleattr(TyObject *self, TyObject *args)
{
TyObject *mod_name, *attr_name;
if (!TyArg_ParseTuple(args, "OO", &mod_name, &attr_name)) {
return NULL;
}
NULLABLE(mod_name);
NULLABLE(attr_name);
return TyImport_ImportModuleAttr(mod_name, attr_name);
}
// Test TyImport_ImportModuleAttrString()
static TyObject *
pyimport_importmoduleattrstring(TyObject *self, TyObject *args)
{
const char *mod_name, *attr_name;
Ty_ssize_t len;
if (!TyArg_ParseTuple(args, "z#z#", &mod_name, &len, &attr_name, &len)) {
return NULL;
}
return TyImport_ImportModuleAttrString(mod_name, attr_name);
}
static TyMethodDef test_methods[] = {
{"TyImport_ImportModuleAttr", pyimport_importmoduleattr, METH_VARARGS},
{"TyImport_ImportModuleAttrString", pyimport_importmoduleattrstring, METH_VARARGS},
{NULL},
};
int
_PyTestCapi_Init_Import(TyObject *m)
{
return TyModule_AddFunctions(m, test_methods);
}