mirror of
https://github.com/johndoe6345789/typthon.git
synced 2026-04-24 13:45:05 +00:00
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>
96 lines
2.4 KiB
C
96 lines
2.4 KiB
C
#include "parts.h"
|
|
#include "util.h"
|
|
|
|
static TyObject *
|
|
eval_get_func_name(TyObject *self, TyObject *func)
|
|
{
|
|
return TyUnicode_FromString(TyEval_GetFuncName(func));
|
|
}
|
|
|
|
static TyObject *
|
|
eval_get_func_desc(TyObject *self, TyObject *func)
|
|
{
|
|
return TyUnicode_FromString(TyEval_GetFuncDesc(func));
|
|
}
|
|
|
|
static TyObject *
|
|
eval_getlocals(TyObject *module, TyObject *Py_UNUSED(args))
|
|
{
|
|
return Ty_XNewRef(TyEval_GetLocals());
|
|
}
|
|
|
|
static TyObject *
|
|
eval_getglobals(TyObject *module, TyObject *Py_UNUSED(args))
|
|
{
|
|
return Ty_XNewRef(TyEval_GetGlobals());
|
|
}
|
|
|
|
static TyObject *
|
|
eval_getbuiltins(TyObject *module, TyObject *Py_UNUSED(args))
|
|
{
|
|
return Ty_XNewRef(TyEval_GetBuiltins());
|
|
}
|
|
|
|
static TyObject *
|
|
eval_getframe(TyObject *module, TyObject *Py_UNUSED(args))
|
|
{
|
|
return Ty_XNewRef(TyEval_GetFrame());
|
|
}
|
|
|
|
static TyObject *
|
|
eval_getframe_builtins(TyObject *module, TyObject *Py_UNUSED(args))
|
|
{
|
|
return TyEval_GetFrameBuiltins();
|
|
}
|
|
|
|
static TyObject *
|
|
eval_getframe_globals(TyObject *module, TyObject *Py_UNUSED(args))
|
|
{
|
|
return TyEval_GetFrameGlobals();
|
|
}
|
|
|
|
static TyObject *
|
|
eval_getframe_locals(TyObject *module, TyObject *Py_UNUSED(args))
|
|
{
|
|
return TyEval_GetFrameLocals();
|
|
}
|
|
|
|
static TyObject *
|
|
eval_get_recursion_limit(TyObject *module, TyObject *Py_UNUSED(args))
|
|
{
|
|
int limit = Ty_GetRecursionLimit();
|
|
return TyLong_FromLong(limit);
|
|
}
|
|
|
|
static TyObject *
|
|
eval_set_recursion_limit(TyObject *module, TyObject *args)
|
|
{
|
|
int limit;
|
|
if (!TyArg_ParseTuple(args, "i", &limit)) {
|
|
return NULL;
|
|
}
|
|
Ty_SetRecursionLimit(limit);
|
|
Py_RETURN_NONE;
|
|
}
|
|
|
|
static TyMethodDef test_methods[] = {
|
|
{"eval_get_func_name", eval_get_func_name, METH_O, NULL},
|
|
{"eval_get_func_desc", eval_get_func_desc, METH_O, NULL},
|
|
{"eval_getlocals", eval_getlocals, METH_NOARGS},
|
|
{"eval_getglobals", eval_getglobals, METH_NOARGS},
|
|
{"eval_getbuiltins", eval_getbuiltins, METH_NOARGS},
|
|
{"eval_getframe", eval_getframe, METH_NOARGS},
|
|
{"eval_getframe_builtins", eval_getframe_builtins, METH_NOARGS},
|
|
{"eval_getframe_globals", eval_getframe_globals, METH_NOARGS},
|
|
{"eval_getframe_locals", eval_getframe_locals, METH_NOARGS},
|
|
{"eval_get_recursion_limit", eval_get_recursion_limit, METH_NOARGS},
|
|
{"eval_set_recursion_limit", eval_set_recursion_limit, METH_VARARGS},
|
|
{NULL},
|
|
};
|
|
|
|
int
|
|
_PyTestLimitedCAPI_Init_Eval(TyObject *m)
|
|
{
|
|
return TyModule_AddFunctions(m, test_methods);
|
|
}
|