mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
PyObjBag refers Context instead of vm
This commit is contained in:
1 parent
95cd2f926b
commit
93d1438345
12 files changed
+49
-42
No files matched your search
@@ -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);
|
||||
|
||||
@@ -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())
|
||||
|
||||
Reference in new issue
Block a user