PyObjBag refers Context instead of vm

This commit is contained in:
Jeong Yunwon committed 2022-05-16 04:45:13 +09:00
1 parent 95cd2f926b
commit 93d1438345
12 files changed
+49 -42

No files matched your search

+1 -1
View File
@@ -11,7 +11,7 @@ fn run(vm: &vm::VirtualMachine) -> vm::PyResult<()> {
// https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-crates
let module = vm::py_compile!(file = "examples/freeze/freeze.py");
let res = vm.run_code_obj(vm.new_code_object(module), scope);
let res = vm.run_code_obj(vm.ctx.new_code(module), scope);
if let Err(exc) = res {
vm.print_exception(exc);
+1 -1
View File
@@ -15,7 +15,7 @@ macro_rules! add_python_function {
// compile the code to bytecode
let code = vm::py_compile!(source = $src);
// convert the rustpython_bytecode::CodeObject to a PyRef<PyCode>
let code = $vm.new_code_object(code);
let code = $vm.ctx.new_code(code);
// run the python code in the scope to store the function
$vm.run_code_obj(code, $scope.clone())