This commit is contained in:
blueloveTH 2024-04-29 13:06:39 +08:00
parent c7495853ec
commit 1227667735

View File

@ -1344,7 +1344,7 @@ void VM::bind__delitem__(Type type, void (*f)(VM*, PyObject*, PyObject*)){
#define BIND_UNARY_SPECIAL(name) \
void VM::bind##name(Type type, PyObject* (*f)(VM*, PyObject*)){ \
_all_types[type].m##name = f; \
PyObject* nf = bind_method<0>(_t(type), #name, [](VM* vm, ArgsView args){ \
PyObject* nf = bind_method<0>(_t(type), name, [](VM* vm, ArgsView args){ \
return lambda_get_userdata<PyObject*(*)(VM*, PyObject*)>(args.begin())(vm, args[0]);\
}); \
PK_OBJ_GET(NativeFunc, nf).set_userdata(f); \
@ -1381,7 +1381,7 @@ void VM::bind__len__(Type type, i64 (*f)(VM*, PyObject*)){
#define BIND_BINARY_SPECIAL(name) \
void VM::bind##name(Type type, BinaryFuncC f){ \
_all_types[type].m##name = f; \
PyObject* nf = bind_method<1>(type, #name, [](VM* vm, ArgsView args){ \
PyObject* nf = bind_method<1>(type, name, [](VM* vm, ArgsView args){ \
return lambda_get_userdata<BinaryFuncC>(args.begin())(vm, args[0], args[1]);\
}); \
PK_OBJ_GET(NativeFunc, nf).set_userdata(f); \