File tree 1 file changed +6
-7
lines changed
1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -765,9 +765,12 @@ fn impl_complex_enum(
765
765
doc : PythonDoc ,
766
766
methods_type : PyClassMethodsType ,
767
767
) -> Result < TokenStream > {
768
- // Need to rig the enum PyClass to be subclassable by the variant PyClasses
768
+ // Need to rig the enum PyClass options
769
769
let args = {
770
770
let mut rigged_args = args. clone ( ) ;
771
+ // Needs to be frozen to disallow `&mut self` methods, which could break a runtime invariant
772
+ rigged_args. options . frozen = parse_quote ! ( frozen) ;
773
+ // Needs to be subclassable by the variant PyClasses
771
774
rigged_args. options . subclass = parse_quote ! ( subclass) ;
772
775
rigged_args
773
776
} ;
@@ -843,14 +846,10 @@ fn impl_complex_enum(
843
846
} ;
844
847
variant_cls_zsts. push ( variant_cls_zst) ;
845
848
846
- // TODO(mkovaxx): propagate variant.options
847
- let options: PyClassPyO3Options = parse_quote ! {
848
- extends = #cls, frozen
849
- } ;
850
-
851
849
let variant_args = PyClassArgs {
852
850
class_kind : PyClassKind :: Struct ,
853
- options,
851
+ // TODO(mkovaxx): propagate variant.options
852
+ options : parse_quote ! ( extends = #cls, frozen) ,
854
853
deprecations : Deprecations :: new ( ) ,
855
854
} ;
856
855
You can’t perform that action at this time.
0 commit comments