@@ -10,7 +10,7 @@ use crate::common::{
1010use crate :: {
1111 builtins:: PyBaseExceptionRef ,
1212 class:: { PyClassImpl , StaticType } ,
13- function:: { FuncArgs , KwArgs , OptionalArg } ,
13+ function:: { FuncArgs , KwArgs , OptionalArg , PySetterValue } ,
1414 identifier,
1515 protocol:: PyNumberMethods ,
1616 types:: { Callable , GetAttr , PyTypeFlags , PyTypeSlots , SetAttr } ,
@@ -757,7 +757,7 @@ impl SetAttr for PyType {
757757 fn setattro (
758758 zelf : & crate :: Py < Self > ,
759759 attr_name : PyStrRef ,
760- value : Option < PyObjectRef > ,
760+ value : PySetterValue ,
761761 vm : & VirtualMachine ,
762762 ) -> PyResult < ( ) > {
763763 // TODO: pass PyRefExact instead of &str
@@ -768,10 +768,10 @@ impl SetAttr for PyType {
768768 return descriptor ( attr, zelf. to_owned ( ) . into ( ) , value, vm) ;
769769 }
770770 }
771- let assign = value. is_some ( ) ;
771+ let assign = value. is_assign ( ) ;
772772
773773 let mut attributes = zelf. attributes . write ( ) ;
774- if let Some ( value) = value {
774+ if let PySetterValue :: Assign ( value) = value {
775775 attributes. insert ( attr_name, value) ;
776776 } else {
777777 let prev_value = attributes. remove ( attr_name) ;
@@ -848,7 +848,7 @@ fn subtype_set_dict(obj: PyObjectRef, value: PyObjectRef, vm: &VirtualMachine) -
848848 cls. name( )
849849 ) )
850850 } ) ?;
851- descr_set ( descr, obj, Some ( value) , vm)
851+ descr_set ( descr, obj, PySetterValue :: Assign ( value) , vm)
852852 }
853853 None => {
854854 object:: object_set_dict ( obj, value. try_into_value ( vm) ?, vm) ?;
0 commit comments