This commit is contained in:
blueloveTH 2024-08-09 11:04:30 +08:00
parent 651bf997fc
commit 3fbbd9fb67
2 changed files with 11 additions and 5 deletions

File diff suppressed because one or more lines are too long

View File

@ -90,6 +90,11 @@ static bool type__name__getter(int argc, py_Ref argv) {
return true; return true;
} }
static bool type__getitem__(int argc, py_Ref argv) {
py_assign(py_retval(), argv);
return true;
}
void pk_object__register() { void pk_object__register() {
// TODO: use staticmethod // TODO: use staticmethod
py_bindmagic(tp_object, __new__, object__new__); py_bindmagic(tp_object, __new__, object__new__);
@ -102,6 +107,7 @@ void pk_object__register() {
py_bindmagic(tp_type, __repr__, type__repr__); py_bindmagic(tp_type, __repr__, type__repr__);
py_bindmagic(tp_type, __new__, type__new__); py_bindmagic(tp_type, __new__, type__new__);
py_bindmagic(tp_type, __getitem__, type__getitem__);
py_bindproperty(tp_type, "__base__", type__base__getter, NULL); py_bindproperty(tp_type, "__base__", type__base__getter, NULL);
py_bindproperty(tp_type, "__name__", type__name__getter, NULL); py_bindproperty(tp_type, "__name__", type__name__getter, NULL);