Просмотр исходного кода

fix https://github.com/blueloveTH/pocketpy/issues/135

blueloveTH 2 лет назад
Родитель
Сommit
ef6b3db24e
2 измененных файлов с 3 добавлено и 3 удалено
  1. 1 1
      include/pocketpy/vm.h
  2. 2 2
      src/vm.cpp

+ 1 - 1
include/pocketpy/vm.h

@@ -169,7 +169,7 @@ public:
     PyObject* find_name_in_mro(PyObject* cls, StrName name);
     bool isinstance(PyObject* obj, Type cls_t);
     PyObject* exec(Str source, Str filename, CompileMode mode, PyObject* _module=nullptr);
-    void exec(Str source);
+    PyObject* exec(Str source);
     PyObject* eval(Str source);
 
     template<typename ...Args>

+ 2 - 2
src/vm.cpp

@@ -114,8 +114,8 @@ namespace pkpy{
         return nullptr;
     }
 
-    void VM::exec(Str source){
-        exec(source, "main.py", EXEC_MODE);
+    PyObject* VM::exec(Str source){
+        return exec(source, "main.py", EXEC_MODE);
     }
 
     PyObject* VM::eval(Str source){