From 36ff4e37d360fe8dad35409b25e65aef34fe53d2 Mon Sep 17 00:00:00 2001 From: coolreader18 <33094578+coolreader18@users.noreply.github.com> Date: Fri, 22 Mar 2019 07:29:14 -0500 Subject: [PATCH] Use vm.get_attribute --- src/main.rs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/main.rs b/src/main.rs index 87ed80868e..4393946273 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,14 +10,8 @@ extern crate rustyline; use clap::{App, Arg}; use rustpython_parser::error::ParseError; use rustpython_vm::{ - compile, - error::CompileError, - frame::Scope, - import, - obj::objstr, - print_exception, - pyobject::{AttributeProtocol, PyResult}, - util, VirtualMachine, + compile, error::CompileError, frame::Scope, import, obj::objstr, print_exception, + pyobject::PyResult, util, VirtualMachine, }; use rustyline::{error::ReadlineError, Editor}; use std::path::{Path, PathBuf}; @@ -160,8 +154,8 @@ fn get_history_path() -> PathBuf { } fn get_prompt(vm: &mut VirtualMachine, prompt_name: &str) -> String { - vm.sys_module - .get_attr(prompt_name) + vm.get_attribute(vm.sys_module.clone(), prompt_name) + .ok() .as_ref() .map(objstr::get_value) .unwrap_or_else(String::new)