@@ -66,15 +66,17 @@ pub struct Scope {
6666impl PyContext {
6767 pub fn new ( ) -> PyContext {
6868 let type_type = objtype:: create_type ( ) ;
69+ let function_type = objfunction:: create_type ( type_type. clone ( ) ) ;
70+ let bound_method_type = objfunction:: create_bound_method_type ( type_type. clone ( ) ) ;
6971
7072 PyContext {
7173 int_type : objint:: create_type ( type_type. clone ( ) ) ,
72- list_type : objlist:: create_type ( type_type. clone ( ) ) ,
74+ list_type : objlist:: create_type ( type_type. clone ( ) , function_type . clone ( ) ) ,
7375 tuple_type : type_type. clone ( ) ,
7476 dict_type : type_type. clone ( ) ,
7577 none : PyObject :: new ( PyObjectKind :: None , type_type. clone ( ) ) ,
76- function_type : objfunction :: create_type ( type_type . clone ( ) ) ,
77- bound_method_type : objfunction :: create_bound_method_type ( type_type . clone ( ) ) ,
78+ function_type : function_type ,
79+ bound_method_type : bound_method_type ,
7880 type_type : type_type,
7981 }
8082 }
@@ -253,7 +255,6 @@ impl AttributeProtocol for PyObjectRef {
253255 PyObjectKind :: Module { name : _, ref dict } => dict. get_item ( attr_name) ,
254256 PyObjectKind :: Class { name : _, ref dict } => dict. get_item ( attr_name) ,
255257 PyObjectKind :: Instance { ref dict } => dict. get_item ( attr_name) ,
256- PyObjectKind :: List { elements : _ } => self . typ ( ) . get_attr ( attr_name) ,
257258 ref kind => unimplemented ! ( "load_attr unimplemented for: {:?}" , kind) ,
258259 }
259260 }
@@ -264,8 +265,7 @@ impl AttributeProtocol for PyObjectRef {
264265 PyObjectKind :: Module { name : _, ref dict } => dict. contains_key ( attr_name) ,
265266 PyObjectKind :: Class { name : _, ref dict } => dict. contains_key ( attr_name) ,
266267 PyObjectKind :: Instance { ref dict } => dict. contains_key ( attr_name) ,
267- PyObjectKind :: List { elements : _ } => self . typ ( ) . has_attr ( attr_name) ,
268- ref kind => unimplemented ! ( "load_attr unimplemented for: {:?}" , kind) ,
268+ _ => false ,
269269 }
270270 }
271271
0 commit comments