@@ -445,39 +445,75 @@ static int doGeneric(VirtualFrame frame, Object obj, Object typ,
445
445
abstract static class PyObjectRichCompareNode extends PythonTernaryBuiltinNode {
446
446
447
447
@ Specialization (guards = "op == 0" )
448
- static Object op0 (VirtualFrame frame , Object a , Object b , @ SuppressWarnings ("unused" ) int op ,
449
- @ Cached BinaryComparisonNode .LtNode compNode ) {
450
- return compNode .executeObject (frame , a , b );
448
+ Object op0 (VirtualFrame frame , Object a , Object b , @ SuppressWarnings ("unused" ) int op ,
449
+ @ Cached BinaryComparisonNode .LtNode compNode ,
450
+ @ Shared ("e" ) @ Cached TransformExceptionToNativeNode transformExceptionToNativeNode ) {
451
+ try {
452
+ return compNode .executeObject (frame , a , b );
453
+ } catch (PException e ) {
454
+ transformExceptionToNativeNode .execute (frame , e );
455
+ return getContext ().getNativeNull ();
456
+ }
451
457
}
452
458
453
459
@ Specialization (guards = "op == 1" )
454
- static Object op1 (VirtualFrame frame , Object a , Object b , @ SuppressWarnings ("unused" ) int op ,
455
- @ Cached BinaryComparisonNode .LeNode compNode ) {
456
- return compNode .executeObject (frame , a , b );
460
+ Object op1 (VirtualFrame frame , Object a , Object b , @ SuppressWarnings ("unused" ) int op ,
461
+ @ Cached BinaryComparisonNode .LeNode compNode ,
462
+ @ Shared ("e" ) @ Cached TransformExceptionToNativeNode transformExceptionToNativeNode ) {
463
+ try {
464
+ return compNode .executeObject (frame , a , b );
465
+ } catch (PException e ) {
466
+ transformExceptionToNativeNode .execute (frame , e );
467
+ return getContext ().getNativeNull ();
468
+ }
457
469
}
458
470
459
471
@ Specialization (guards = "op == 2" )
460
- static Object op2 (VirtualFrame frame , Object a , Object b , @ SuppressWarnings ("unused" ) int op ,
461
- @ Cached BinaryComparisonNode .EqNode compNode ) {
462
- return compNode .executeObject (frame , a , b );
472
+ Object op2 (VirtualFrame frame , Object a , Object b , @ SuppressWarnings ("unused" ) int op ,
473
+ @ Cached BinaryComparisonNode .EqNode compNode ,
474
+ @ Shared ("e" ) @ Cached TransformExceptionToNativeNode transformExceptionToNativeNode ) {
475
+ try {
476
+ return compNode .executeObject (frame , a , b );
477
+ } catch (PException e ) {
478
+ transformExceptionToNativeNode .execute (frame , e );
479
+ return getContext ().getNativeNull ();
480
+ }
463
481
}
464
482
465
483
@ Specialization (guards = "op == 3" )
466
- static Object op3 (VirtualFrame frame , Object a , Object b , @ SuppressWarnings ("unused" ) int op ,
467
- @ Cached BinaryComparisonNode .NeNode compNode ) {
468
- return compNode .executeObject (frame , a , b );
484
+ Object op3 (VirtualFrame frame , Object a , Object b , @ SuppressWarnings ("unused" ) int op ,
485
+ @ Cached BinaryComparisonNode .NeNode compNode ,
486
+ @ Shared ("e" ) @ Cached TransformExceptionToNativeNode transformExceptionToNativeNode ) {
487
+ try {
488
+ return compNode .executeObject (frame , a , b );
489
+ } catch (PException e ) {
490
+ transformExceptionToNativeNode .execute (frame , e );
491
+ return getContext ().getNativeNull ();
492
+ }
469
493
}
470
494
471
495
@ Specialization (guards = "op == 4" )
472
- static Object op4 (VirtualFrame frame , Object a , Object b , @ SuppressWarnings ("unused" ) int op ,
473
- @ Cached BinaryComparisonNode .GtNode compNode ) {
474
- return compNode .executeObject (frame , a , b );
496
+ Object op4 (VirtualFrame frame , Object a , Object b , @ SuppressWarnings ("unused" ) int op ,
497
+ @ Cached BinaryComparisonNode .GtNode compNode ,
498
+ @ Shared ("e" ) @ Cached TransformExceptionToNativeNode transformExceptionToNativeNode ) {
499
+ try {
500
+ return compNode .executeObject (frame , a , b );
501
+ } catch (PException e ) {
502
+ transformExceptionToNativeNode .execute (frame , e );
503
+ return getContext ().getNativeNull ();
504
+ }
475
505
}
476
506
477
507
@ Specialization (guards = "op == 5" )
478
- static Object op5 (VirtualFrame frame , Object a , Object b , @ SuppressWarnings ("unused" ) int op ,
479
- @ Cached BinaryComparisonNode .GeNode compNode ) {
480
- return compNode .executeObject (frame , a , b );
508
+ Object op5 (VirtualFrame frame , Object a , Object b , @ SuppressWarnings ("unused" ) int op ,
509
+ @ Cached BinaryComparisonNode .GeNode compNode ,
510
+ @ Shared ("e" ) @ Cached TransformExceptionToNativeNode transformExceptionToNativeNode ) {
511
+ try {
512
+ return compNode .executeObject (frame , a , b );
513
+ } catch (PException e ) {
514
+ transformExceptionToNativeNode .execute (frame , e );
515
+ return getContext ().getNativeNull ();
516
+ }
481
517
}
482
518
}
483
519
0 commit comments