mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 11:30:18 +00:00
...
This commit is contained in:
parent
6bd2f59c8f
commit
ca73a1a248
@ -16,12 +16,12 @@ namespace pkpy {
|
|||||||
vm->TypeError("expected '" #mod "." #name "', got " + OBJ_NAME(vm->_t(val)).escape()); \
|
vm->TypeError("expected '" #mod "." #name "', got " + OBJ_NAME(vm->_t(val)).escape()); \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
static PyObject* register_class(VM* vm, PyObject* mod) { \
|
static PyObject* register_class(VM* vm, PyObject* mod, Type base=0) { \
|
||||||
if(OBJ_NAME(mod) != #mod) { \
|
if(OBJ_NAME(mod) != #mod) { \
|
||||||
auto msg = fmt("register_class() failed: ", OBJ_NAME(mod), " != ", #mod); \
|
auto msg = fmt("register_class() failed: ", OBJ_NAME(mod), " != ", #mod); \
|
||||||
throw std::runtime_error(msg); \
|
throw std::runtime_error(msg); \
|
||||||
} \
|
} \
|
||||||
PyObject* type = vm->new_type_object(mod, #name, vm->tp_object); \
|
PyObject* type = vm->new_type_object(mod, #name, base); \
|
||||||
T::_register(vm, mod, type); \
|
T::_register(vm, mod, type); \
|
||||||
type->attr()._try_perfect_rehash(); \
|
type->attr()._try_perfect_rehash(); \
|
||||||
return type; \
|
return type; \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user