@@ -6,7 +6,7 @@ use std::error::Error;
6
6
use std:: path:: PathBuf ;
7
7
8
8
use super :: compile;
9
- use super :: pyobject:: { DictProtocol , PyResult } ;
9
+ use super :: pyobject:: { AttributeProtocol , DictProtocol , PyResult } ;
10
10
use super :: util;
11
11
use super :: vm:: VirtualMachine ;
12
12
use obj:: { objsequence, objstr} ;
@@ -55,7 +55,7 @@ pub fn import_module(
55
55
module_name : & str ,
56
56
) -> PyResult {
57
57
// First, see if we already loaded the module:
58
- let sys_modules = vm. sys_module . get_item ( "modules" ) . unwrap ( ) ;
58
+ let sys_modules = vm. sys_module . get_attr ( "modules" ) . unwrap ( ) ;
59
59
if let Some ( module) = sys_modules. get_item ( module_name) {
60
60
return Ok ( module) ;
61
61
}
@@ -74,7 +74,7 @@ pub fn import(
74
74
// If we're importing a symbol, look it up and use it, otherwise construct a module and return
75
75
// that
76
76
if let Some ( symbol) = symbol {
77
- module. get_item ( symbol) . map_or_else (
77
+ module. get_attr ( symbol) . map_or_else (
78
78
|| {
79
79
let import_error = vm. context ( ) . exceptions . import_error . clone ( ) ;
80
80
Err ( vm. new_exception ( import_error, format ! ( "cannot import name '{}'" , symbol) ) )
@@ -87,7 +87,7 @@ pub fn import(
87
87
}
88
88
89
89
fn find_source ( vm : & VirtualMachine , current_path : PathBuf , name : & str ) -> Result < PathBuf , String > {
90
- let sys_path = vm. sys_module . get_item ( "path" ) . unwrap ( ) ;
90
+ let sys_path = vm. sys_module . get_attr ( "path" ) . unwrap ( ) ;
91
91
let mut paths: Vec < PathBuf > = objsequence:: get_elements ( & sys_path)
92
92
. iter ( )
93
93
. map ( |item| PathBuf :: from ( objstr:: get_value ( item) ) )
0 commit comments