Skip to content

Commit 5fdef44

Browse files
committed
[GR-11605] Remove C landing functions.
PullRequest: graalpython/651
2 parents 34e60f0 + e2857f4 commit 5fdef44

File tree

22 files changed

+1684
-793
lines changed

22 files changed

+1684
-793
lines changed

graalpython/com.oracle.graal.python.cext/modules/_memoryview.c

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -957,7 +957,10 @@ PyMemoryView_GetContiguous(PyObject *obj, int buffertype, char order)
957957
}
958958

959959

960-
static PyObject *
960+
// n.b.: using return type 'PyMemoryViewObject *' is a workaround
961+
// for Sulong's behavior that it overwrites the polyglot cast with
962+
// the function's static return type.
963+
static PyMemoryViewObject *
961964
memory_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds)
962965
{
963966
PyObject *obj;
@@ -3131,7 +3134,7 @@ PyTypeObject PyNativeMemoryView_Type = {
31313134
0, /* tp_dictoffset */
31323135
0, /* tp_init */
31333136
0, /* tp_alloc */
3134-
memory_new, /* tp_new */
3137+
(newfunc)memory_new, /* tp_new */
31353138
};
31363139

31373140

@@ -3156,12 +3159,23 @@ static void memory_managed_releasebuf(PyMemoryViewObject *self, Py_buffer *view)
31563159
memory_releasebuf(_get_managed_self(self), view);
31573160
}
31583161

3162+
static PyMemoryViewObject *
3163+
attach_native_type(PyObject *module, PyObject *obj)
3164+
{
3165+
return polyglot_from_PyMemoryViewObject((PyMemoryViewObject *)obj);
3166+
}
3167+
3168+
static PyMethodDef _memoryviewmodule_methods[] = {
3169+
{"attach_native_type", (PyCFunction)attach_native_type, METH_O, NULL},
3170+
{NULL, NULL}
3171+
};
3172+
31593173
static struct PyModuleDef _memoryviewmodule = {
31603174
PyModuleDef_HEAD_INIT,
31613175
"_memoryview",
31623176
"",
31633177
-1,
3164-
NULL,
3178+
_memoryviewmodule_methods,
31653179
NULL,
31663180
NULL,
31673181
NULL,

graalpython/com.oracle.graal.python.cext/src/capi.c

Lines changed: 10 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ void *PY_TRUFFLE_CEXT;
4444
void *PY_BUILTIN;
4545
void *Py_NoValue;
4646

47+
void*(*pytruffle_decorate_function)(void *fun0, void* fun1);
4748

4849
PyObject*(*PY_TRUFFLE_LANDING)(void *rcv, void* name, ...);
4950
void*(*PY_TRUFFLE_LANDING_L)(void *rcv, void* name, ...);
@@ -62,6 +63,8 @@ static void initialize_upcall_functions() {
6263
PY_TRUFFLE_CEXT = (void*)polyglot_eval("python", "import python_cext\npython_cext");
6364
PY_BUILTIN = (void*)polyglot_eval("python", "import builtins\nbuiltins");
6465

66+
pytruffle_decorate_function = ((void*(*)(void *fun0, void* fun1))polyglot_get_member(PY_TRUFFLE_CEXT, polyglot_from_string("PyTruffle_Decorate_Function", SRC_CS)));
67+
6568
PY_TRUFFLE_LANDING = ((PyObject*(*)(void *rcv, void* name, ...))polyglot_get_member(PY_TRUFFLE_CEXT, polyglot_from_string("PyTruffle_Upcall", SRC_CS)));
6669
PY_TRUFFLE_LANDING_L = ((void*(*)(void *rcv, void* name, ...))polyglot_get_member(PY_TRUFFLE_CEXT, polyglot_from_string("PyTruffle_Upcall_l", SRC_CS)));
6770
PY_TRUFFLE_LANDING_D = ((void*(*)(void *rcv, void* name, ...))polyglot_get_member(PY_TRUFFLE_CEXT, polyglot_from_string("PyTruffle_Upcall_d", SRC_CS)));
@@ -167,6 +170,7 @@ initialize_type(_PyWeakref_ProxyType, ProxyType, PyWeakReference);
167170
initialize_type(_PyWeakref_CallableProxyType, CallableProxyType, PyWeakReference);
168171

169172
POLYGLOT_DECLARE_TYPE(PyThreadState);
173+
POLYGLOT_DECLARE_TYPE(newfunc);
170174

171175
static void initialize_globals() {
172176
// register native NULL
@@ -260,7 +264,7 @@ PyObject* to_sulong(void *o) {
260264

261265
/** to be used from Java code only; reads native 'ob_type' field */
262266
PyTypeObject* get_ob_type(PyObject* obj) {
263-
return polyglot_from__typeobject(native_type_to_java(obj->ob_type));
267+
return native_type_to_java(obj->ob_type);
264268
}
265269

266270
/** to be used from Java code only; reads native 'tp_dict' field */
@@ -328,6 +332,11 @@ polyglot_typeid get_thread_state_typeid() {
328332
return polyglot_PyThreadState_typeid();
329333
}
330334

335+
/** to be used from Java code only; returns the type ID newfunc */
336+
polyglot_typeid get_newfunc_typeid() {
337+
return polyglot_newfunc_typeid();
338+
}
339+
331340
typedef struct PyObjectHandle {
332341
PyObject_HEAD
333342
} PyObjectHandle;
@@ -613,135 +622,8 @@ int PyTruffle_Debug(void *arg) {
613622
return 0;
614623
}
615624

616-
typedef PyObject* (*f0)();
617-
typedef PyObject* (*f1)(PyObject*);
618-
typedef PyObject* (*f2)(PyObject*, PyObject*);
619-
typedef PyObject* (*f3)(PyObject*, PyObject*, PyObject*);
620-
typedef PyObject* (*f4)(PyObject*, PyObject*, PyObject*, PyObject*);
621-
typedef PyObject* (*f5)(PyObject*, PyObject*, PyObject*, PyObject*, PyObject*);
622-
typedef PyObject* (*f6)(PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*);
623-
typedef PyObject* (*f7)(PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*);
624-
typedef PyObject* (*f8)(PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*);
625-
typedef PyObject* (*f9)(PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*);
626-
typedef PyObject* (*f10)(PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*);
627-
typedef PyObject* (*f11)(PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*);
628-
typedef PyObject* (*f12)(PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*);
629-
typedef PyObject* (*f13)(PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*);
630-
typedef PyObject* (*f14)(PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*);
631-
typedef PyObject* (*f15)(PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*);
632-
typedef PyObject* (*f16)(PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*);
633-
typedef PyObject* (*f17)(PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*);
634-
typedef PyObject* (*f18)(PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*);
635-
typedef PyObject* (*f19)(PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*);
636-
typedef PyObject* (*f20)(PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*);
637-
638-
#define _PICK_FUN_CAST(DUMMY, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, NAME, ...) NAME
639-
#define _CALL_ARITY(FUN, ...) ( (_PICK_FUN_CAST(NULL, ##__VA_ARGS__, f20, f19, f18, f17, f16, f15, f14, f13, f12, f11, f10, f9, f8, f7, f6, f5, f4, f3, f2, f1, f0))(FUN))(__VA_ARGS__)
640625
#define ARG(__n) ((PyObject*)polyglot_get_arg((__n)))
641626

642-
NO_INLINE
643-
int wrap_setter(PyCFunction fun, PyObject* self, PyObject* value, void* closure) {
644-
return _CALL_ARITY(fun, ARG(1), ARG(2), ARG(3));
645-
}
646-
647-
NO_INLINE
648-
void* wrap_direct(PyCFunction fun, ...) {
649-
PyObject *res = NULL;
650-
switch(polyglot_get_arg_count()-1) {
651-
case 0:
652-
res = _CALL_ARITY(fun);
653-
break;
654-
case 1:
655-
res = _CALL_ARITY(fun, ARG(1));
656-
break;
657-
case 2:
658-
res = _CALL_ARITY(fun, ARG(1), ARG(2));
659-
break;
660-
case 3:
661-
res = _CALL_ARITY(fun, ARG(1), ARG(2), ARG(3));
662-
break;
663-
case 4:
664-
res = _CALL_ARITY(fun, ARG(1), ARG(2), ARG(3), ARG(4));
665-
break;
666-
case 5:
667-
res = _CALL_ARITY(fun, ARG(1), ARG(2), ARG(3), ARG(4), ARG(5));
668-
break;
669-
case 6:
670-
res = _CALL_ARITY(fun, ARG(1), ARG(2), ARG(3), ARG(4), ARG(5), ARG(6));
671-
break;
672-
case 7:
673-
res = _CALL_ARITY(fun, ARG(1), ARG(2), ARG(3), ARG(4), ARG(5), ARG(6), ARG(7));
674-
break;
675-
case 8:
676-
res = _CALL_ARITY(fun, ARG(1), ARG(2), ARG(3), ARG(4), ARG(5), ARG(6), ARG(7), ARG(8));
677-
break;
678-
case 9:
679-
res = _CALL_ARITY(fun, ARG(1), ARG(2), ARG(3), ARG(4), ARG(5), ARG(6), ARG(7), ARG(8), ARG(9));
680-
break;
681-
case 10:
682-
res = _CALL_ARITY(fun, ARG(1), ARG(2), ARG(3), ARG(4), ARG(5), ARG(6), ARG(7), ARG(8), ARG(9), ARG(10));
683-
break;
684-
case 11:
685-
res = _CALL_ARITY(fun, ARG(1), ARG(2), ARG(3), ARG(4), ARG(5), ARG(6), ARG(7), ARG(8), ARG(9), ARG(10), ARG(11));
686-
break;
687-
case 12:
688-
res = _CALL_ARITY(fun, ARG(1), ARG(2), ARG(3), ARG(4), ARG(5), ARG(6), ARG(7), ARG(8), ARG(9), ARG(10), ARG(11), ARG(12));
689-
break;
690-
case 13:
691-
res = _CALL_ARITY(fun, ARG(1), ARG(2), ARG(3), ARG(4), ARG(5), ARG(6), ARG(7), ARG(8), ARG(9), ARG(10), ARG(11), ARG(12), ARG(13));
692-
break;
693-
case 14:
694-
res = _CALL_ARITY(fun, ARG(1), ARG(2), ARG(3), ARG(4), ARG(5), ARG(6), ARG(7), ARG(8), ARG(9), ARG(10), ARG(11), ARG(12), ARG(13), ARG(14));
695-
break;
696-
case 15:
697-
res = _CALL_ARITY(fun, ARG(1), ARG(2), ARG(3), ARG(4), ARG(5), ARG(6), ARG(7), ARG(8), ARG(9), ARG(10), ARG(11), ARG(12), ARG(13), ARG(14), ARG(15));
698-
break;
699-
case 16:
700-
res = _CALL_ARITY(fun, ARG(1), ARG(2), ARG(3), ARG(4), ARG(5), ARG(6), ARG(7), ARG(8), ARG(9), ARG(10), ARG(11), ARG(12), ARG(13), ARG(14), ARG(15), ARG(16));
701-
break;
702-
case 17:
703-
res = _CALL_ARITY(fun, ARG(1), ARG(2), ARG(3), ARG(4), ARG(5), ARG(6), ARG(7), ARG(8), ARG(9), ARG(10), ARG(11), ARG(12), ARG(13), ARG(14), ARG(15), ARG(16), ARG(17));
704-
break;
705-
case 18:
706-
res = _CALL_ARITY(fun, ARG(1), ARG(2), ARG(3), ARG(4), ARG(5), ARG(6), ARG(7), ARG(8), ARG(9), ARG(10), ARG(11), ARG(12), ARG(13), ARG(14), ARG(15), ARG(16), ARG(17), ARG(18));
707-
break;
708-
case 19:
709-
res = _CALL_ARITY(fun, ARG(1), ARG(2), ARG(3), ARG(4), ARG(5), ARG(6), ARG(7), ARG(8), ARG(9), ARG(10), ARG(11), ARG(12), ARG(13), ARG(14), ARG(15), ARG(16), ARG(17), ARG(18), ARG(19));
710-
break;
711-
case 20:
712-
res = _CALL_ARITY(fun, ARG(1), ARG(2), ARG(3), ARG(4), ARG(5), ARG(6), ARG(7), ARG(8), ARG(9), ARG(10), ARG(11), ARG(12), ARG(13), ARG(14), ARG(15), ARG(16), ARG(17), ARG(18), ARG(19), ARG(20));
713-
break;
714-
default:
715-
_PyErr_BadInternalCall(__FILE__, __LINE__);
716-
res = NULL;
717-
}
718-
return native_to_java(res);
719-
}
720-
721-
void* wrap_varargs(PyCFunction fun, PyObject *module, PyObject *varargs) {
722-
return native_to_java(fun(module, varargs));
723-
}
724-
725-
void* wrap_keywords(PyCFunctionWithKeywords fun, PyObject *module, PyObject *varargs, PyObject *kwargs) {
726-
return native_to_java(fun(module, varargs, kwargs));
727-
}
728-
729-
void* wrap_noargs(PyCFunction fun, PyObject *module, PyObject *pnone) {
730-
return native_to_java(fun(module, pnone));
731-
}
732-
733-
void* wrap_fastcall(_PyCFunctionFast fun, PyObject *self, PyObject **args, PyObject *nargs) {
734-
return native_to_java(fun(self, PySequence_Fast_ITEMS((PyObject*)args), PyLong_AsSsize_t(nargs)));
735-
}
736-
737-
void* wrap_fastcall_with_keywords(_PyCFunctionFastWithKeywords fun, PyObject *self, PyObject **args, PyObject *nargs, PyObject *kwnames) {
738-
return native_to_java(fun(self, PySequence_Fast_ITEMS((PyObject*)args), PyLong_AsSsize_t(nargs), kwnames));
739-
}
740-
741-
void* wrap_unsupported(void *fun, ...) {
742-
return NULL;
743-
}
744-
745627
int truffle_ptr_compare(void* x, void* y, int op) {
746628
switch (op) {
747629
case Py_LT:

graalpython/com.oracle.graal.python.cext/src/capi.h

Lines changed: 38 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ double polyglot_ensure_double(void *obj) {
109109
}
110110

111111
/* upcall functions for calling into Python */
112+
void*(*pytruffle_decorate_function)(void *fun0, void* fun1);
112113
extern PyObject*(*PY_TRUFFLE_LANDING)(void *rcv, void* name, ...);
113114
extern void*(*PY_TRUFFLE_LANDING_L)(void *rcv, void* name, ...);
114115
extern void*(*PY_TRUFFLE_LANDING_D)(void *rcv, void* name, ...);
@@ -134,7 +135,7 @@ extern void* (*PY_TRUFFLE_CEXT_LANDING_PTR)(void* name, ...);
134135
#define UPCALL_D(__recv__, __name__, ...) (polyglot_ensure_double(PY_TRUFFLE_LANDING_D((__recv__), __name__, ##__VA_ARGS__)))
135136

136137
/* Call function with return type 'void*'; no polyglot cast and no error handling */
137-
#define UPCALL_PTR(__name__, ...) (polyglot_ensure_ptr(PY_TRUFFLE_LANDING_PTR(__name__, ##__VA_ARGS__)))
138+
#define UPCALL_PTR(__recv__, __name__, ...) (polyglot_ensure_ptr(PY_TRUFFLE_LANDING_PTR((__recv__), __name__, ##__VA_ARGS__)))
138139

139140
/* Call function of 'python_cext' module with return type 'PyObject *'; does polyglot cast and error handling */
140141
#define UPCALL_CEXT_O(__name__, ...) PY_TRUFFLE_CEXT_LANDING(__name__, ##__VA_ARGS__)
@@ -190,8 +191,9 @@ extern cache_t cache;
190191
void initialize_type_structure(PyTypeObject* structure, PyTypeObject* ptype, polyglot_typeid tid);
191192
Py_ssize_t PyTruffle_Type_AddSlots(PyTypeObject* cls, PyObject* slotsTuple);
192193

194+
193195
__attribute__((always_inline))
194-
inline void* native_to_java(PyObject* obj) {
196+
inline void* native_to_java(void* obj) {
195197
if (obj == NULL) {
196198
return Py_NoValue;
197199
} else if (obj == Py_None) {
@@ -204,6 +206,9 @@ inline void* native_to_java(PyObject* obj) {
204206
return obj;
205207
}
206208

209+
210+
extern void* native_to_java_exported(PyObject* obj);
211+
207212
__attribute__((always_inline))
208213
inline void* native_to_java_slim(PyObject* obj) {
209214
if (!truffle_cannot_be_handle(obj)) {
@@ -229,50 +234,47 @@ void initialize_exceptions();
229234
// defined in 'pyhash.c'
230235
void initialize_hashes();
231236

232-
// prototype of C landing function
233-
void* wrap_direct(PyCFunction fun, ...);
234-
int wrap_setter(PyCFunction fun, PyObject *self, PyObject *value, void *closure);
235-
void* wrap_varargs(PyCFunction fun, PyObject *module, PyObject *varargs);
236-
void* wrap_noargs(PyCFunction fun, PyObject *module, PyObject *pnone);
237-
void* wrap_keywords(PyCFunctionWithKeywords fun, PyObject *module, PyObject *varargs, PyObject *kwargs);
238-
void* wrap_fastcall(_PyCFunctionFast fun, PyObject * self, PyObject **args, PyObject *nargs);
239-
void* wrap_fastcall_with_keywords(_PyCFunctionFastWithKeywords fun, PyObject * self, PyObject **args, PyObject *nargs, PyObject *kwnames);
240-
void* wrap_unsupported(void *fun, ...);
237+
#define JWRAPPER_DIRECT (polyglot_invoke(PY_TRUFFLE_CEXT, "METH_DIRECT"))
238+
#define JWRAPPER_FASTCALL (polyglot_invoke(PY_TRUFFLE_CEXT, "METH_FASTCALL"))
239+
#define JWRAPPER_FASTCALL_WITH_KEYWORDS (polyglot_invoke(PY_TRUFFLE_CEXT, "METH_FASTCALL_WITH_KEYWORDS"))
240+
#define JWRAPPER_KEYWORDS (polyglot_invoke(PY_TRUFFLE_CEXT, "METH_KEYWORDS"))
241+
#define JWRAPPER_VARARGS (polyglot_invoke(PY_TRUFFLE_CEXT, "METH_VARARGS"))
242+
#define JWRAPPER_NOARGS (polyglot_invoke(PY_TRUFFLE_CEXT, "METH_NOARGS"))
243+
#define JWRAPPER_O (polyglot_invoke(PY_TRUFFLE_CEXT, "METH_O"))
244+
#define JWRAPPER_UNSUPPORTED (polyglot_invoke(PY_TRUFFLE_CEXT, "METH_UNSUPPORTED"))
245+
#define JWRAPPER_ALLOC (polyglot_invoke(PY_TRUFFLE_CEXT, "METH_ALLOC"))
246+
#define JWRAPPER_SSIZE_ARG JWRAPPER_ALLOC
247+
#define JWRAPPER_GETATTR (polyglot_invoke(PY_TRUFFLE_CEXT, "METH_GETATTR"))
248+
#define JWRAPPER_SETATTR (polyglot_invoke(PY_TRUFFLE_CEXT, "METH_SETATTR"))
249+
#define JWRAPPER_RICHCMP (polyglot_invoke(PY_TRUFFLE_CEXT, "METH_RICHCMP"))
250+
#define JWRAPPER_SSIZE_OBJ_ARG (polyglot_invoke(PY_TRUFFLE_CEXT, "METH_SSIZE_OBJ_ARG"))
251+
#define JWRAPPER_REVERSE (polyglot_invoke(PY_TRUFFLE_CEXT, "METH_REVERSE"))
252+
#define JWRAPPER_POW (polyglot_invoke(PY_TRUFFLE_CEXT, "METH_POW"))
253+
#define JWRAPPER_REVERSE_POW (polyglot_invoke(PY_TRUFFLE_CEXT, "METH_REVERSE_POW"))
254+
#define JWRAPPER_LT (polyglot_invoke(PY_TRUFFLE_CEXT, "METH_LT"))
255+
#define JWRAPPER_LE (polyglot_invoke(PY_TRUFFLE_CEXT, "METH_LE"))
256+
#define JWRAPPER_EQ (polyglot_invoke(PY_TRUFFLE_CEXT, "METH_EQ"))
257+
#define JWRAPPER_NE (polyglot_invoke(PY_TRUFFLE_CEXT, "METH_NE"))
258+
#define JWRAPPER_GT (polyglot_invoke(PY_TRUFFLE_CEXT, "METH_GT"))
259+
#define JWRAPPER_GE (polyglot_invoke(PY_TRUFFLE_CEXT, "METH_GE"))
241260

242261
#define TDEBUG __builtin_debugtrap()
243262
#define get_method_flags_wrapper(flags) \
244263
(((flags) < 0) ? \
245-
polyglot_get_member(PY_TRUFFLE_CEXT, "METH_DIRECT") : \
264+
JWRAPPER_DIRECT : \
246265
((((flags) & (METH_FASTCALL | METH_KEYWORDS)) == (METH_FASTCALL | METH_KEYWORDS)) ? \
247-
polyglot_get_member(PY_TRUFFLE_CEXT, "METH_FASTCALL_WITH_KEYWORDS") : \
266+
JWRAPPER_FASTCALL_WITH_KEYWORDS : \
248267
(((flags) & METH_FASTCALL) ? \
249-
polyglot_get_member(PY_TRUFFLE_CEXT, "METH_FASTCALL") : \
268+
JWRAPPER_FASTCALL : \
250269
(((flags) & METH_KEYWORDS) ? \
251-
polyglot_get_member(PY_TRUFFLE_CEXT, "METH_KEYWORDS") : \
270+
JWRAPPER_KEYWORDS : \
252271
(((flags) & METH_VARARGS) ? \
253-
polyglot_get_member(PY_TRUFFLE_CEXT, "METH_VARARGS") : \
272+
JWRAPPER_VARARGS : \
254273
(((flags) & METH_NOARGS) ? \
255-
polyglot_get_member(PY_TRUFFLE_CEXT, "METH_NOARGS") : \
274+
JWRAPPER_NOARGS : \
256275
(((flags) & METH_O) ? \
257-
polyglot_get_member(PY_TRUFFLE_CEXT, "METH_O") : \
258-
polyglot_get_member(PY_TRUFFLE_CEXT, "METH_UNSUPPORTED"))))))))
259-
260-
#define get_method_flags_cwrapper(flags) \
261-
(void*)((((flags) < 0) ? \
262-
wrap_direct : \
263-
((((flags) & (METH_FASTCALL | METH_KEYWORDS)) == (METH_FASTCALL | METH_KEYWORDS)) ? \
264-
wrap_fastcall_with_keywords : \
265-
(((flags) & METH_FASTCALL) ? \
266-
wrap_fastcall : \
267-
(((flags) & METH_KEYWORDS) ? \
268-
wrap_keywords : \
269-
(((flags) & METH_VARARGS) ? \
270-
wrap_varargs : \
271-
(((flags) & METH_NOARGS) ? \
272-
wrap_noargs : \
273-
(((flags) & METH_O) ? \
274-
wrap_direct : \
275-
wrap_unsupported))))))))
276+
JWRAPPER_O : \
277+
JWRAPPER_UNSUPPORTED)))))))
276278

277279
#define PY_TRUFFLE_TYPE_WITH_ALLOC(__TYPE_NAME__, __SUPER_TYPE__, __FLAGS__, __SIZE__, __ALLOC__) {\
278280
PyVarObject_HEAD_INIT((__SUPER_TYPE__), 0)\

0 commit comments

Comments
 (0)