瀏覽代碼

some doc fix

BLUELOVETH 2 年之前
父節點
當前提交
458f3c84a6
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. 3 3
      docs/quick-start/exec.md

+ 3 - 3
docs/quick-start/exec.md

@@ -50,10 +50,10 @@ These two methods are provided for this purpose:
 
 ```cpp
 try{
-    PyObject* result = vm->exec("123", "<eval>", EVAL_MODE);
-    std::cout << py_cast<int>(vm, result);   // 123
+    CodeObject_ code = vm->compile("a[0]", "main.py", EXEC_MODE, false);
+    vm->_exec(code, vm->_main);
 }catch(Exception& e){
     // use e.summary() to get a summary of the exception
     std::cerr << e.summary() << std::endl;
 }
-```
+```