Skip to content

Commit 97cfbb4

Browse files
committed
Use correct type for tp_str/tp_repr wrappers
1 parent 7c18fd9 commit 97cfbb4

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,8 @@ void initialize_hashes();
334334
#define JWRAPPER_OBJOBJARGPROC 40
335335
#define JWRAPPER_NEW 41
336336
#define JWRAPPER_MP_DELITEM 42
337+
#define JWRAPPER_STR 43
338+
#define JWRAPPER_REPR 44
337339

338340
#define TDEBUG __builtin_debugtrap()
339341
#define get_method_flags_wrapper(flags) \

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -580,10 +580,10 @@ int PyType_Ready(PyTypeObject* cls) {
580580
// and convert arguments that should be C primitives.
581581
ADD_SLOT_CONV("__getattr__", cls->tp_getattr, -2, JWRAPPER_GETATTR);
582582
ADD_SLOT_CONV("__setattr__", cls->tp_setattr, -3, JWRAPPER_SETATTR);
583-
ADD_SLOT_CONV("__repr__", cls->tp_repr, -1, JWRAPPER_UNARYFUNC);
583+
ADD_SLOT_CONV("__repr__", cls->tp_repr, -1, JWRAPPER_REPR);
584584
ADD_SLOT_CONV("__hash__", cls->tp_hash, -1, JWRAPPER_HASHFUNC);
585585
ADD_SLOT_CONV("__call__", cls->tp_call, METH_KEYWORDS | METH_VARARGS, JWRAPPER_CALL);
586-
ADD_SLOT_CONV("__str__", cls->tp_str, -1, JWRAPPER_UNARYFUNC);
586+
ADD_SLOT_CONV("__str__", cls->tp_str, -1, JWRAPPER_STR);
587587
ADD_SLOT_CONV("__getattr__", cls->tp_getattro, -2, JWRAPPER_DIRECT);
588588
ADD_SLOT_CONV("__setattr__", cls->tp_setattro, -3, JWRAPPER_SETATTRO);
589589
ADD_SLOT_CONV("__clear__", cls->tp_clear, -1, JWRAPPER_INQUIRY);

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/capi/ExternalFunctionNodes.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,9 @@ public enum PExternalFunctionWrapper {
215215
OBJOBJPROC(39, 0, AllToSulongNode::create, CheckInquiryResultNodeGen::create),
216216
OBJOBJARGPROC(40, 0, AllToSulongNode::create, CheckPrimitiveFunctionResultNodeGen::create),
217217
NEW(41),
218-
MP_DELITEM(42, 0, AllToSulongNode::create, CheckPrimitiveFunctionResultNodeGen::create);
218+
MP_DELITEM(42, 0, AllToSulongNode::create, CheckPrimitiveFunctionResultNodeGen::create),
219+
TP_STR(43),
220+
TP_REPR(44);
219221

220222
@CompilationFinal(dimensions = 1) private static final PExternalFunctionWrapper[] VALUES = Arrays.copyOf(values(), values().length);
221223

@@ -272,6 +274,8 @@ static RootCallTarget getOrCreateCallTarget(PExternalFunctionWrapper sig, Python
272274
case UNARYFUNC:
273275
case BINARYFUNC:
274276
case BINARYFUNC_L:
277+
case TP_STR:
278+
case TP_REPR:
275279
/*
276280
* If no conversion is requested, this means we directly call a managed function
277281
* (without argument conversion). Null indicates this

0 commit comments

Comments
 (0)