@@ -337,7 +337,7 @@ static void add_method_or_slot(PyTypeObject* cls, PyObject* type_dict, char* nam
337
337
cls ,
338
338
native_to_java (type_dict ),
339
339
polyglot_from_string (name , SRC_CS ),
340
- native_pointer_to_java (result_conversion != NULL ? pytruffle_decorate_function (native_pointer_to_java (meth ), result_conversion ) : meth ),
340
+ native_pointer_to_java (result_conversion != NULL ? pytruffle_decorate_function (native_pointer_to_java (meth ), result_conversion ) : native_pointer_to_java ( meth ) ),
341
341
(signature != NULL ? signature : get_method_flags_wrapper (flags )),
342
342
doc ? polyglot_from_string (doc , SRC_CS ) : native_to_java (Py_None ),
343
343
(flags ) > 0 && ((flags ) & METH_CLASS ) != 0 ,
@@ -363,8 +363,8 @@ int PyType_Ready(PyTypeObject* cls) {
363
363
} while(0)
364
364
365
365
#define ADD_IF_MISSING (attr , def ) if (!(attr)) { attr = def; }
366
- #define ADD_METHOD (m ) ADD_METHOD_OR_SLOT(m.ml_name, native_to_java_stealing_exported , m.ml_meth, m.ml_flags, NULL, m.ml_doc)
367
- #define ADD_SLOT (name , meth , flags ) ADD_METHOD_OR_SLOT(name, native_to_java_stealing_exported , meth, flags, NULL, name)
366
+ #define ADD_METHOD (m ) ADD_METHOD_OR_SLOT(m.ml_name, NULL , m.ml_meth, m.ml_flags, NULL, m.ml_doc)
367
+ #define ADD_SLOT (name , meth , flags ) ADD_METHOD_OR_SLOT(name, NULL , meth, flags, NULL, name)
368
368
#define ADD_SLOT_PRIMITIVE (name , meth , flags ) ADD_METHOD_OR_SLOT(name, NULL, meth, flags, NULL, name)
369
369
#define ADD_SLOT_CONV (name , result_conversion , meth , flags , signature ) ADD_METHOD_OR_SLOT(name, result_conversion, meth, flags, signature, name)
370
370
#define ADD_METHOD_OR_SLOT (__name__ , __res_conv__ , __meth__ , __flags__ , __signature__ , __doc__ ) \
@@ -510,7 +510,7 @@ int PyType_Ready(PyTypeObject* cls) {
510
510
511
511
// NOTE: The slots may be called from managed code, i.e., we need to wrap the functions
512
512
// and convert arguments that should be C primitives.
513
- ADD_SLOT_CONV ("__getattr__" , native_to_java_stealing_exported , cls -> tp_getattr , -2 , JWRAPPER_GETATTR );
513
+ ADD_SLOT_CONV ("__getattr__" , NULL , cls -> tp_getattr , -2 , JWRAPPER_GETATTR );
514
514
ADD_SLOT_CONV ("__setattr__" , NULL , cls -> tp_setattr , -3 , JWRAPPER_SETATTR );
515
515
ADD_SLOT ("__repr__" , cls -> tp_repr , -1 );
516
516
ADD_SLOT_PRIMITIVE ("__hash__" , cls -> tp_hash , -1 );
@@ -525,20 +525,20 @@ int PyType_Ready(PyTypeObject* cls) {
525
525
the default function dispatches to the individual comparison functions which would in
526
526
this case again invoke 'object.__truffle_richcompare__'. */
527
527
if (cls -> tp_richcompare && cls -> tp_richcompare != PyBaseObject_Type .tp_richcompare ) {
528
- ADD_SLOT_CONV ("__compare__" , native_to_java_stealing_exported , cls -> tp_richcompare , -3 , JWRAPPER_RICHCMP );
529
- ADD_SLOT_CONV ("__lt__" , native_to_java_stealing_exported , cls -> tp_richcompare , -2 , JWRAPPER_LT );
530
- ADD_SLOT_CONV ("__le__" , native_to_java_stealing_exported , cls -> tp_richcompare , -2 , JWRAPPER_LE );
531
- ADD_SLOT_CONV ("__eq__" , native_to_java_stealing_exported , cls -> tp_richcompare , -2 , JWRAPPER_EQ );
532
- ADD_SLOT_CONV ("__ne__" , native_to_java_stealing_exported , cls -> tp_richcompare , -2 , JWRAPPER_NE );
533
- ADD_SLOT_CONV ("__gt__" , native_to_java_stealing_exported , cls -> tp_richcompare , -2 , JWRAPPER_GT );
534
- ADD_SLOT_CONV ("__ge__" , native_to_java_stealing_exported , cls -> tp_richcompare , -2 , JWRAPPER_GE );
528
+ ADD_SLOT_CONV ("__compare__" , NULL , cls -> tp_richcompare , -3 , JWRAPPER_RICHCMP );
529
+ ADD_SLOT_CONV ("__lt__" , NULL , cls -> tp_richcompare , -2 , JWRAPPER_LT );
530
+ ADD_SLOT_CONV ("__le__" , NULL , cls -> tp_richcompare , -2 , JWRAPPER_LE );
531
+ ADD_SLOT_CONV ("__eq__" , NULL , cls -> tp_richcompare , -2 , JWRAPPER_EQ );
532
+ ADD_SLOT_CONV ("__ne__" , NULL , cls -> tp_richcompare , -2 , JWRAPPER_NE );
533
+ ADD_SLOT_CONV ("__gt__" , NULL , cls -> tp_richcompare , -2 , JWRAPPER_GT );
534
+ ADD_SLOT_CONV ("__ge__" , NULL , cls -> tp_richcompare , -2 , JWRAPPER_GE );
535
535
}
536
536
ADD_SLOT ("__iter__" , cls -> tp_iter , -1 );
537
537
ADD_SLOT ("__next__" , cls -> tp_iternext , -1 );
538
538
ADD_SLOT ("__get__" , cls -> tp_descr_get , -3 );
539
539
ADD_SLOT_PRIMITIVE ("__set__" , cls -> tp_descr_set , -3 );
540
540
ADD_SLOT_PRIMITIVE ("__init__" , cls -> tp_init , METH_KEYWORDS | METH_VARARGS );
541
- ADD_SLOT_CONV ("__alloc__" , native_to_java_stealing_exported , cls -> tp_alloc , -2 , JWRAPPER_ALLOC );
541
+ ADD_SLOT_CONV ("__alloc__" , NULL , cls -> tp_alloc , -2 , JWRAPPER_ALLOC );
542
542
ADD_SLOT ("__new__" , cls -> tp_new , METH_KEYWORDS | METH_VARARGS );
543
543
ADD_SLOT_PRIMITIVE ("__free__" , cls -> tp_free , -1 );
544
544
ADD_SLOT_PRIMITIVE ("__del__" , cls -> tp_del , -1 );
@@ -547,32 +547,32 @@ int PyType_Ready(PyTypeObject* cls) {
547
547
PyNumberMethods * numbers = cls -> tp_as_number ;
548
548
if (numbers ) {
549
549
ADD_SLOT ("__add__" , numbers -> nb_add , -2 );
550
- ADD_SLOT_CONV ("__radd__" , native_to_java_stealing_exported , numbers -> nb_add , -2 , JWRAPPER_REVERSE );
550
+ ADD_SLOT_CONV ("__radd__" , NULL , numbers -> nb_add , -2 , JWRAPPER_REVERSE );
551
551
ADD_SLOT ("__sub__" , numbers -> nb_subtract , -2 );
552
- ADD_SLOT_CONV ("__rsub__" , native_to_java_stealing_exported , numbers -> nb_subtract , -2 , JWRAPPER_REVERSE );
552
+ ADD_SLOT_CONV ("__rsub__" , NULL , numbers -> nb_subtract , -2 , JWRAPPER_REVERSE );
553
553
ADD_SLOT ("__mul__" , numbers -> nb_multiply , -2 );
554
- ADD_SLOT_CONV ("__rmul__" , native_to_java_stealing_exported , numbers -> nb_multiply , -2 , JWRAPPER_REVERSE );
554
+ ADD_SLOT_CONV ("__rmul__" , NULL , numbers -> nb_multiply , -2 , JWRAPPER_REVERSE );
555
555
ADD_SLOT ("__mod__" , numbers -> nb_remainder , -2 );
556
- ADD_SLOT_CONV ("__rmod__" , native_to_java_stealing_exported , numbers -> nb_remainder , -2 , JWRAPPER_REVERSE );
556
+ ADD_SLOT_CONV ("__rmod__" , NULL , numbers -> nb_remainder , -2 , JWRAPPER_REVERSE );
557
557
ADD_SLOT ("__divmod__" , numbers -> nb_divmod , -2 );
558
- ADD_SLOT_CONV ("__rdivmod__" , native_to_java_stealing_exported , numbers -> nb_divmod , -2 , JWRAPPER_REVERSE );
559
- ADD_SLOT_CONV ("__pow__" , native_to_java_stealing_exported , numbers -> nb_power , -3 , JWRAPPER_POW );
560
- ADD_SLOT_CONV ("__rpow__" , native_to_java_stealing_exported , numbers -> nb_power , -3 , JWRAPPER_REVERSE_POW );
558
+ ADD_SLOT_CONV ("__rdivmod__" , NULL , numbers -> nb_divmod , -2 , JWRAPPER_REVERSE );
559
+ ADD_SLOT_CONV ("__pow__" , NULL , numbers -> nb_power , -3 , JWRAPPER_POW );
560
+ ADD_SLOT_CONV ("__rpow__" , NULL , numbers -> nb_power , -3 , JWRAPPER_REVERSE_POW );
561
561
ADD_SLOT ("__neg__" , numbers -> nb_negative , -1 );
562
562
ADD_SLOT ("__pos__" , numbers -> nb_positive , -1 );
563
563
ADD_SLOT ("__abs__" , numbers -> nb_absolute , -1 );
564
564
ADD_SLOT_CONV ("__bool__" , native_int_to_bool , numbers -> nb_bool , -1 , NULL );
565
565
ADD_SLOT ("__invert__" , numbers -> nb_invert , -1 );
566
566
ADD_SLOT ("__lshift__" , numbers -> nb_lshift , -2 );
567
- ADD_SLOT_CONV ("__rlshift__" , native_to_java_stealing_exported , numbers -> nb_lshift , -2 , JWRAPPER_REVERSE );
567
+ ADD_SLOT_CONV ("__rlshift__" , NULL , numbers -> nb_lshift , -2 , JWRAPPER_REVERSE );
568
568
ADD_SLOT ("__rshift__" , numbers -> nb_rshift , -2 );
569
- ADD_SLOT_CONV ("__rrshift__" , native_to_java_stealing_exported , numbers -> nb_rshift , -2 , JWRAPPER_REVERSE );
569
+ ADD_SLOT_CONV ("__rrshift__" , NULL , numbers -> nb_rshift , -2 , JWRAPPER_REVERSE );
570
570
ADD_SLOT ("__and__" , numbers -> nb_and , -2 );
571
- ADD_SLOT_CONV ("__rand__" , native_to_java_stealing_exported , numbers -> nb_and , -2 , JWRAPPER_REVERSE );
571
+ ADD_SLOT_CONV ("__rand__" , NULL , numbers -> nb_and , -2 , JWRAPPER_REVERSE );
572
572
ADD_SLOT ("__xor__" , numbers -> nb_xor , -2 );
573
- ADD_SLOT_CONV ("__rxor__" , native_to_java_stealing_exported , numbers -> nb_xor , -2 , JWRAPPER_REVERSE );
573
+ ADD_SLOT_CONV ("__rxor__" , NULL , numbers -> nb_xor , -2 , JWRAPPER_REVERSE );
574
574
ADD_SLOT ("__or__" , numbers -> nb_or , -2 );
575
- ADD_SLOT_CONV ("__ror__" , native_to_java_stealing_exported , numbers -> nb_or , -2 , JWRAPPER_REVERSE );
575
+ ADD_SLOT_CONV ("__ror__" , NULL , numbers -> nb_or , -2 , JWRAPPER_REVERSE );
576
576
ADD_SLOT ("__int__" , numbers -> nb_int , -1 );
577
577
ADD_SLOT ("__float__" , numbers -> nb_float , -1 );
578
578
ADD_SLOT ("__iadd__" , numbers -> nb_inplace_add , -2 );
@@ -586,27 +586,27 @@ int PyType_Ready(PyTypeObject* cls) {
586
586
ADD_SLOT ("__ixor__" , numbers -> nb_inplace_xor , -2 );
587
587
ADD_SLOT ("__ior__" , numbers -> nb_inplace_or , -2 );
588
588
ADD_SLOT ("__floordiv__" , numbers -> nb_floor_divide , -2 );
589
- ADD_SLOT_CONV ("__rfloordiv__" , native_to_java_stealing_exported , numbers -> nb_floor_divide , -2 , JWRAPPER_REVERSE );
589
+ ADD_SLOT_CONV ("__rfloordiv__" , NULL , numbers -> nb_floor_divide , -2 , JWRAPPER_REVERSE );
590
590
ADD_SLOT ("__truediv__" , numbers -> nb_true_divide , -2 );
591
- ADD_SLOT_CONV ("__rtruediv__" , native_to_java_stealing_exported , numbers -> nb_true_divide , -2 , JWRAPPER_REVERSE );
591
+ ADD_SLOT_CONV ("__rtruediv__" , NULL , numbers -> nb_true_divide , -2 , JWRAPPER_REVERSE );
592
592
ADD_SLOT ("__ifloordiv__" , numbers -> nb_inplace_floor_divide , -2 );
593
593
ADD_SLOT ("__itruediv__" , numbers -> nb_inplace_true_divide , -2 );
594
594
ADD_SLOT ("__index__" , numbers -> nb_index , -1 );
595
595
ADD_SLOT ("__matmul__" , numbers -> nb_matrix_multiply , -2 );
596
- ADD_SLOT_CONV ("__rmatmul__" , native_to_java_stealing_exported , numbers -> nb_matrix_multiply , -2 , JWRAPPER_REVERSE );
596
+ ADD_SLOT_CONV ("__rmatmul__" , NULL , numbers -> nb_matrix_multiply , -2 , JWRAPPER_REVERSE );
597
597
ADD_SLOT ("__imatmul__" , numbers -> nb_inplace_matrix_multiply , -2 );
598
598
}
599
599
600
600
PySequenceMethods * sequences = cls -> tp_as_sequence ;
601
601
if (sequences ) {
602
602
ADD_SLOT_PRIMITIVE ("__len__" , sequences -> sq_length , -1 );
603
603
ADD_SLOT ("__add__" , sequences -> sq_concat , -2 );
604
- ADD_SLOT_CONV ("__mul__" , native_to_java_stealing_exported , sequences -> sq_repeat , -2 , JWRAPPER_SSIZE_ARG );
605
- ADD_SLOT_CONV ("__getitem__" , native_to_java_stealing_exported , sequences -> sq_item , -2 , JWRAPPER_SSIZE_ARG );
604
+ ADD_SLOT_CONV ("__mul__" , NULL , sequences -> sq_repeat , -2 , JWRAPPER_SSIZE_ARG );
605
+ ADD_SLOT_CONV ("__getitem__" , NULL , sequences -> sq_item , -2 , JWRAPPER_SSIZE_ARG );
606
606
ADD_SLOT_CONV ("__setitem__" , NULL , sequences -> sq_ass_item , -3 , JWRAPPER_SSIZE_OBJ_ARG );
607
607
ADD_SLOT_PRIMITIVE ("__contains__" , sequences -> sq_contains , -2 );
608
608
ADD_SLOT ("__iadd__" , sequences -> sq_inplace_concat , -2 );
609
- ADD_SLOT_CONV ("__imul__" , native_to_java_stealing_exported , sequences -> sq_inplace_repeat , -2 , JWRAPPER_SSIZE_ARG );
609
+ ADD_SLOT_CONV ("__imul__" , NULL , sequences -> sq_inplace_repeat , -2 , JWRAPPER_SSIZE_ARG );
610
610
}
611
611
612
612
PyMappingMethods * mappings = cls -> tp_as_mapping ;
0 commit comments