This commit is contained in:
blueloveTH 2023-05-19 22:46:04 +08:00
parent e5fb7a65ff
commit 834e3f3e71
2 changed files with 3 additions and 5 deletions

View File

@ -200,10 +200,9 @@ inline void init_builtins(VM* _vm) {
});
_vm->bind__repr__(_vm->tp_object, [](VM* vm, PyObject* obj) {
PyObject* self = obj;
if(is_tagged(obj)) self = nullptr;
if(is_tagged(obj)) FATAL_ERROR();
std::stringstream ss;
ss << "<" << OBJ_NAME(vm->_t(self)) << " object at " << std::hex << self << ">";
ss << "<" << OBJ_NAME(vm->_t(obj)) << " object at " << std::hex << obj << ">";
return VAR(ss.str());
});

View File

@ -340,9 +340,8 @@ public:
#define BIND_UNARY_SPECIAL(name) \
void bind##name(Type type, PyObject* (*f)(VM* vm, PyObject*)){ \
PyObject* obj = _t(type); \
_all_types[type].m##name = f; \
bind_method<0>(obj, #name, [](VM* vm, ArgsView args){ \
bind_method<0>(_t(type), #name, [](VM* vm, ArgsView args){ \
return vm->_inst_type_info(args[0])->m##name(vm, args[0]); \
}); \
}