Skip to content

Commit 36ff4e3

Browse files
committed
Use vm.get_attribute
1 parent 5c8c4a8 commit 36ff4e3

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

src/main.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,8 @@ extern crate rustyline;
1010
use clap::{App, Arg};
1111
use rustpython_parser::error::ParseError;
1212
use rustpython_vm::{
13-
compile,
14-
error::CompileError,
15-
frame::Scope,
16-
import,
17-
obj::objstr,
18-
print_exception,
19-
pyobject::{AttributeProtocol, PyResult},
20-
util, VirtualMachine,
13+
compile, error::CompileError, frame::Scope, import, obj::objstr, print_exception,
14+
pyobject::PyResult, util, VirtualMachine,
2115
};
2216
use rustyline::{error::ReadlineError, Editor};
2317
use std::path::{Path, PathBuf};
@@ -160,8 +154,8 @@ fn get_history_path() -> PathBuf {
160154
}
161155

162156
fn get_prompt(vm: &mut VirtualMachine, prompt_name: &str) -> String {
163-
vm.sys_module
164-
.get_attr(prompt_name)
157+
vm.get_attribute(vm.sys_module.clone(), prompt_name)
158+
.ok()
165159
.as_ref()
166160
.map(objstr::get_value)
167161
.unwrap_or_else(String::new)

0 commit comments

Comments
 (0)