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 @@ -777,9 +777,12 @@ fn impl_complex_enum(
777
777
doc : PythonDoc ,
778
778
methods_type : PyClassMethodsType ,
779
779
) -> Result < TokenStream > {
780
- // Need to rig the enum PyClass to be subclassable by the variant PyClasses
780
+ // Need to rig the enum PyClass options
781
781
let args = {
782
782
let mut rigged_args = args. clone ( ) ;
783
+ // Needs to be frozen to disallow `&mut self` methods, which could break a runtime invariant
784
+ rigged_args. options . frozen = parse_quote ! ( frozen) ;
785
+ // Needs to be subclassable by the variant PyClasses
783
786
rigged_args. options . subclass = parse_quote ! ( subclass) ;
784
787
rigged_args
785
788
} ;
@@ -855,14 +858,10 @@ fn impl_complex_enum(
855
858
} ;
856
859
variant_cls_zsts. push ( variant_cls_zst) ;
857
860
858
- // TODO(mkovaxx): propagate variant.options
859
- let options: PyClassPyO3Options = parse_quote ! {
860
- extends = #cls, frozen
861
- } ;
862
-
863
861
let variant_args = PyClassArgs {
864
862
class_kind : PyClassKind :: Struct ,
865
- options,
863
+ // TODO(mkovaxx): propagate variant.options
864
+ options : parse_quote ! ( extends = #cls, frozen) ,
866
865
deprecations : Deprecations :: new ( ) ,
867
866
} ;
868
867
You can’t perform that action at this time.
0 commit comments