@@ -322,6 +322,7 @@ impl ExceptionCtor {
322
322
#[ derive( Debug , Clone ) ]
323
323
pub struct ExceptionZoo {
324
324
pub base_exception_type : & ' static Py < PyType > ,
325
+ pub base_exception_group : & ' static Py < PyType > ,
325
326
pub system_exit : & ' static Py < PyType > ,
326
327
pub keyboard_interrupt : & ' static Py < PyType > ,
327
328
pub generator_exit : & ' static Py < PyType > ,
@@ -538,6 +539,7 @@ impl ExceptionZoo {
538
539
let base_exception_type = PyBaseException :: init_bare_type ( ) ;
539
540
540
541
// Sorted By Hierarchy then alphabetized.
542
+ let base_exception_group = PyBaseExceptionGroup :: init_bare_type ( ) ;
541
543
let system_exit = PySystemExit :: init_bare_type ( ) ;
542
544
let keyboard_interrupt = PyKeyboardInterrupt :: init_bare_type ( ) ;
543
545
let generator_exit = PyGeneratorExit :: init_bare_type ( ) ;
@@ -623,6 +625,7 @@ impl ExceptionZoo {
623
625
624
626
Self {
625
627
base_exception_type,
628
+ base_exception_group,
626
629
system_exit,
627
630
keyboard_interrupt,
628
631
generator_exit,
@@ -704,6 +707,10 @@ impl ExceptionZoo {
704
707
PyBaseException :: extend_class ( ctx, excs. base_exception_type ) ;
705
708
706
709
// Sorted By Hierarchy then alphabetized.
710
+ extend_exception ! ( PyBaseExceptionGroup , ctx, excs. base_exception_group, {
711
+ "message" => ctx. new_readonly_getset( "message" , excs. base_exception_group, make_arg_getter( 0 ) ) ,
712
+ "exceptions" => ctx. new_readonly_getset( "exceptions" , excs. base_exception_group, make_arg_getter( 1 ) ) ,
713
+ } ) ;
707
714
extend_exception ! ( PySystemExit , ctx, excs. system_exit, {
708
715
"code" => ctx. new_readonly_getset( "code" , excs. system_exit, system_exit_code) ,
709
716
} ) ;
@@ -1139,6 +1146,12 @@ pub(super) mod types {
1139
1146
system_exit,
1140
1147
"Request to exit from the interpreter."
1141
1148
}
1149
+ define_exception ! {
1150
+ PyBaseExceptionGroup ,
1151
+ PyBaseException ,
1152
+ base_exception_group,
1153
+ "A combination of multiple unrelated exceptions."
1154
+ }
1142
1155
define_exception ! {
1143
1156
PyGeneratorExit ,
1144
1157
PyBaseException ,
0 commit comments