Move free functions in vm::exceptions to vm methods · mode9/RustPython@256de1e · GitHub
Skip to content

Commit 256de1e

Browse files
committed
Move free functions in vm::exceptions to vm methods
1 parent 6f902d2 commit 256de1e

12 files changed

Lines changed: 208 additions & 210 deletions

File tree

examples/freeze/main.rs

Lines changed: 2 additions & 2 deletions

examples/mini_repl.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ def fib(n):
7676
scope.globals.set_item("last", output, vm)?;
7777
}
7878
}
79-
Err(e) => {
80-
vm::exceptions::print_exception(vm, e);
79+
Err(exc) => {
80+
vm.print_exception(exc);
8181
}
8282
}
8383
}

src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ extern crate log;
4545

4646
use clap::{App, AppSettings, Arg, ArgMatches};
4747
use rustpython_vm::{
48-
builtins::PyDictRef, builtins::PyInt, compile, exceptions::print_exception, match_class,
49-
scope::Scope, stdlib::sys, InitParameter, Interpreter, ItemProtocol, PyObjectRef, PyResult,
50-
PySettings, TryFromObject, TypeProtocol, VirtualMachine,
48+
builtins::PyDictRef, builtins::PyInt, compile, match_class, scope::Scope, stdlib::sys,
49+
InitParameter, Interpreter, ItemProtocol, PyObjectRef, PyResult, PySettings, TryFromObject,
50+
TypeProtocol, VirtualMachine,
5151
};
5252

5353
use std::convert::TryInto;
@@ -136,8 +136,8 @@ where
136136
}
137137
}
138138
}
139-
Err(err) => {
140-
print_exception(vm, err);
139+
Err(exc) => {
140+
vm.print_exception(exc);
141141
1
142142
}
143143
};

src/shell.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use rustpython_vm::readline::{Readline, ReadlineResult};
55
use rustpython_vm::{
66
builtins::PyBaseExceptionRef,
77
compile::{self, CompileError, CompileErrorType},
8-
exceptions::print_exception,
98
scope::Scope,
109
PyResult, TypeProtocol, VirtualMachine,
1110
};
@@ -130,7 +129,7 @@ pub fn run_shell(vm: &VirtualMachine, scope: Scope) -> PyResult<()> {
130129
repl.save_history(&repl_history_path).unwrap();
131130
return Err(exc);
132131
}
133-
print_exception(vm, exc);
132+
vm.print_exception(exc);
134133
}
135134
}
136135
repl.save_history(&repl_history_path).unwrap();

vm/src/coroutine.rs

Lines changed: 1 addition & 2 deletions

0 commit comments

Comments
 (0)