@@ -661,6 +661,7 @@ impl PyContext {
661661 PyObject :: new (
662662 PyObjectPayload :: Instance {
663663 dict : RefCell :: new ( dict) ,
664+ parent_payload : None ,
664665 } ,
665666 class,
666667 )
@@ -688,7 +689,8 @@ impl PyContext {
688689 PyObjectPayload :: Module { ref scope, .. } => {
689690 scope. locals . set_item ( self , attr_name, value)
690691 }
691- PyObjectPayload :: Instance { ref dict } | PyObjectPayload :: Class { ref dict, .. } => {
692+ PyObjectPayload :: Instance { ref dict, .. }
693+ | PyObjectPayload :: Class { ref dict, .. } => {
692694 dict. borrow_mut ( ) . insert ( attr_name. to_string ( ) , value) ;
693695 }
694696 ref payload => unimplemented ! ( "set_attr unimplemented for: {:?}" , payload) ,
@@ -804,7 +806,7 @@ impl AttributeProtocol for PyObjectRef {
804806 }
805807 None
806808 }
807- PyObjectPayload :: Instance { ref dict } => dict. borrow ( ) . get ( attr_name) . cloned ( ) ,
809+ PyObjectPayload :: Instance { ref dict, .. } => dict. borrow ( ) . get ( attr_name) . cloned ( ) ,
808810 _ => None ,
809811 }
810812 }
@@ -815,7 +817,7 @@ impl AttributeProtocol for PyObjectRef {
815817 PyObjectPayload :: Class { ref mro, .. } => {
816818 class_has_item ( self , attr_name) || mro. iter ( ) . any ( |d| class_has_item ( d, attr_name) )
817819 }
818- PyObjectPayload :: Instance { ref dict } => dict. borrow ( ) . contains_key ( attr_name) ,
820+ PyObjectPayload :: Instance { ref dict, .. } => dict. borrow ( ) . contains_key ( attr_name) ,
819821 _ => false ,
820822 }
821823 }
@@ -1496,6 +1498,7 @@ pub enum PyObjectPayload {
14961498 } ,
14971499 Instance {
14981500 dict : RefCell < PyAttributes > ,
1501+ parent_payload : Option < Box < PyObjectPayload > > ,
14991502 } ,
15001503 RustFunction {
15011504 function : PyNativeFunc ,
0 commit comments