mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 11:30:18 +00:00
some fix
This commit is contained in:
parent
0f47105b27
commit
9943516d79
@ -356,10 +356,12 @@ public:
|
||||
bool issubclass(Type cls, Type base);
|
||||
void check_type(PyObject* obj, Type type){ if(!is_type(obj, type)) TypeError(type, _tp(obj)); }
|
||||
void check_compatible_type(PyObject* obj, Type type){ if(!isinstance(obj, type)) TypeError(type, _tp(obj)); }
|
||||
PyObject* _t(PyObject* obj){ return _all_types[_tp(obj)].obj; }
|
||||
PyObject* _t(Type t){ return _all_types[t.index].obj; }
|
||||
|
||||
Type _tp(PyObject* obj){ return is_small_int(obj) ? tp_int : obj->type; }
|
||||
const PyTypeInfo* _tp_info(PyObject* obj);
|
||||
const PyTypeInfo* _tp_info(PyObject* obj) { return &_all_types[_tp(obj)]; }
|
||||
const PyTypeInfo* _tp_info(Type type) { return &_all_types[type]; }
|
||||
PyObject* _t(PyObject* obj){ return _all_types[_tp(obj)].obj; }
|
||||
PyObject* _t(Type type){ return _all_types[type].obj; }
|
||||
#endif
|
||||
|
||||
#if PK_REGION("User Type Registration")
|
||||
|
@ -212,11 +212,6 @@ namespace pkpy{
|
||||
return obj;
|
||||
}
|
||||
|
||||
const PyTypeInfo* VM::_tp_info(PyObject* obj){
|
||||
if(is_small_int(obj)) return &_all_types[tp_int];
|
||||
return &_all_types[obj->type];
|
||||
}
|
||||
|
||||
bool VM::py_eq(PyObject* lhs, PyObject* rhs){
|
||||
if(lhs == rhs) return true;
|
||||
const PyTypeInfo* ti = _tp_info(lhs);
|
||||
|
Loading…
x
Reference in New Issue
Block a user