@@ -661,6 +661,7 @@ impl PyContext {
661
661
PyObject :: new (
662
662
PyObjectPayload :: Instance {
663
663
dict : RefCell :: new ( dict) ,
664
+ parent_payload : None ,
664
665
} ,
665
666
class,
666
667
)
@@ -688,7 +689,8 @@ impl PyContext {
688
689
PyObjectPayload :: Module { ref scope, .. } => {
689
690
scope. locals . set_item ( self , attr_name, value)
690
691
}
691
- PyObjectPayload :: Instance { ref dict } | PyObjectPayload :: Class { ref dict, .. } => {
692
+ PyObjectPayload :: Instance { ref dict, .. }
693
+ | PyObjectPayload :: Class { ref dict, .. } => {
692
694
dict. borrow_mut ( ) . insert ( attr_name. to_string ( ) , value) ;
693
695
}
694
696
ref payload => unimplemented ! ( "set_attr unimplemented for: {:?}" , payload) ,
@@ -804,7 +806,7 @@ impl AttributeProtocol for PyObjectRef {
804
806
}
805
807
None
806
808
}
807
- PyObjectPayload :: Instance { ref dict } => dict. borrow ( ) . get ( attr_name) . cloned ( ) ,
809
+ PyObjectPayload :: Instance { ref dict, .. } => dict. borrow ( ) . get ( attr_name) . cloned ( ) ,
808
810
_ => None ,
809
811
}
810
812
}
@@ -815,7 +817,7 @@ impl AttributeProtocol for PyObjectRef {
815
817
PyObjectPayload :: Class { ref mro, .. } => {
816
818
class_has_item ( self , attr_name) || mro. iter ( ) . any ( |d| class_has_item ( d, attr_name) )
817
819
}
818
- PyObjectPayload :: Instance { ref dict } => dict. borrow ( ) . contains_key ( attr_name) ,
820
+ PyObjectPayload :: Instance { ref dict, .. } => dict. borrow ( ) . contains_key ( attr_name) ,
819
821
_ => false ,
820
822
}
821
823
}
@@ -1496,6 +1498,7 @@ pub enum PyObjectPayload {
1496
1498
} ,
1497
1499
Instance {
1498
1500
dict : RefCell < PyAttributes > ,
1501
+ parent_payload : Option < Box < PyObjectPayload > > ,
1499
1502
} ,
1500
1503
RustFunction {
1501
1504
function : PyNativeFunc ,
0 commit comments