|
@@ -102,7 +102,7 @@ public:
|
|
|
Type tp_list, tp_tuple;
|
|
Type tp_list, tp_tuple;
|
|
|
Type tp_function, tp_native_func, tp_iterator, tp_bound_method;
|
|
Type tp_function, tp_native_func, tp_iterator, tp_bound_method;
|
|
|
Type tp_slice, tp_range, tp_module;
|
|
Type tp_slice, tp_range, tp_module;
|
|
|
- Type tp_super, tp_exception;
|
|
|
|
|
|
|
+ Type tp_super, tp_exception, tp_bytes;
|
|
|
|
|
|
|
|
VM(bool use_stdio) : heap(this){
|
|
VM(bool use_stdio) : heap(this){
|
|
|
this->vm = this;
|
|
this->vm = this;
|
|
@@ -412,6 +412,7 @@ DEF_NATIVE_2(BoundMethod, tp_bound_method)
|
|
|
DEF_NATIVE_2(Range, tp_range)
|
|
DEF_NATIVE_2(Range, tp_range)
|
|
|
DEF_NATIVE_2(Slice, tp_slice)
|
|
DEF_NATIVE_2(Slice, tp_slice)
|
|
|
DEF_NATIVE_2(Exception, tp_exception)
|
|
DEF_NATIVE_2(Exception, tp_exception)
|
|
|
|
|
+DEF_NATIVE_2(Bytes, tp_bytes)
|
|
|
|
|
|
|
|
#define PY_CAST_INT(T) \
|
|
#define PY_CAST_INT(T) \
|
|
|
template<> inline T py_cast<T>(VM* vm, PyObject* obj){ \
|
|
template<> inline T py_cast<T>(VM* vm, PyObject* obj){ \
|
|
@@ -737,6 +738,7 @@ inline void VM::init_builtin_types(){
|
|
|
tp_bound_method = _new_type_object("bound_method");
|
|
tp_bound_method = _new_type_object("bound_method");
|
|
|
tp_super = _new_type_object("super");
|
|
tp_super = _new_type_object("super");
|
|
|
tp_exception = _new_type_object("Exception");
|
|
tp_exception = _new_type_object("Exception");
|
|
|
|
|
+ tp_bytes = _new_type_object("bytes");
|
|
|
|
|
|
|
|
this->None = heap._new<Dummy>(_new_type_object("NoneType"), {});
|
|
this->None = heap._new<Dummy>(_new_type_object("NoneType"), {});
|
|
|
this->Ellipsis = heap._new<Dummy>(_new_type_object("ellipsis"), {});
|
|
this->Ellipsis = heap._new<Dummy>(_new_type_object("ellipsis"), {});
|
|
@@ -757,6 +759,7 @@ inline void VM::init_builtin_types(){
|
|
|
builtins->attr().set("list", _t(tp_list));
|
|
builtins->attr().set("list", _t(tp_list));
|
|
|
builtins->attr().set("tuple", _t(tp_tuple));
|
|
builtins->attr().set("tuple", _t(tp_tuple));
|
|
|
builtins->attr().set("range", _t(tp_range));
|
|
builtins->attr().set("range", _t(tp_range));
|
|
|
|
|
+ builtins->attr().set("bytes", _t(tp_bytes));
|
|
|
builtins->attr().set("StopIteration", StopIteration);
|
|
builtins->attr().set("StopIteration", StopIteration);
|
|
|
|
|
|
|
|
post_init();
|
|
post_init();
|