File tree 1 file changed +17
-8
lines changed
Filter options
1 file changed +17
-8
lines changed
Original file line number Diff line number Diff line change @@ -388,14 +388,23 @@ impl VirtualMachine {
388
388
if expect_stdlib {
389
389
// enable python-implemented ExceptionGroup when stdlib exists
390
390
let py_core_init = || -> PyResult < ( ) > {
391
- let exception_group = import:: import_frozen ( self , "_py_exceptiongroup" ) ?;
392
- let base_exception_group = exception_group. get_attr ( "BaseExceptionGroup" , self ) ?;
393
- self . builtins
394
- . set_attr ( "BaseExceptionGroup" , base_exception_group, self ) ?;
395
- let exception_group = exception_group. get_attr ( "ExceptionGroup" , self ) ?;
396
- self . builtins
397
- . set_attr ( "ExceptionGroup" , exception_group, self ) ?;
398
- Ok ( ( ) )
391
+ #[ cfg( target_arch = "wasm32" ) ]
392
+ {
393
+ // Skip exceptiongroup for WebAssembly for now
394
+ return Ok ( ( ) ) ;
395
+ }
396
+ #[ cfg( not( target_arch = "wasm32" ) ) ]
397
+ {
398
+ let exception_group = import:: import_frozen ( self , "_py_exceptiongroup" ) ?;
399
+ let base_exception_group =
400
+ exception_group. get_attr ( "BaseExceptionGroup" , self ) ?;
401
+ self . builtins
402
+ . set_attr ( "BaseExceptionGroup" , base_exception_group, self ) ?;
403
+ let exception_group = exception_group. get_attr ( "ExceptionGroup" , self ) ?;
404
+ self . builtins
405
+ . set_attr ( "ExceptionGroup" , exception_group, self ) ?;
406
+ Ok ( ( ) )
407
+ }
399
408
} ;
400
409
self . expect_pyresult ( py_core_init ( ) , "exceptiongroup initialization failed" ) ;
401
410
}
You can’t perform that action at this time.
0 commit comments