Skip to content

Commit 2d239a1

Browse files
committed
Fix sq_ass_item slot wrapper
1 parent 7dafaf2 commit 2d239a1

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

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

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,49 @@ protected String getSignature() {
601601
}
602602
}
603603

604+
@ExportLibrary(InteropLibrary.class)
605+
public static final class SsizeobjargfuncWrapper extends PyProcsWrapper {
606+
607+
public SsizeobjargfuncWrapper(Object delegate) {
608+
super(delegate);
609+
}
610+
611+
@ExportMessage
612+
int execute(Object[] arguments,
613+
@Bind("$node") Node inliningTarget,
614+
@Cached CallTernaryMethodNode executeNode,
615+
@Cached NativeToPythonNode toJavaNode,
616+
@Cached TransformExceptionToNativeNode transformExceptionToNativeNode,
617+
@Exclusive @Cached GilNode gil) throws ArityException {
618+
boolean mustRelease = gil.acquire();
619+
CApiTiming.enter();
620+
try {
621+
if (arguments.length != 3) {
622+
CompilerDirectives.transferToInterpreterAndInvalidate();
623+
throw ArityException.create(3, 3, arguments.length);
624+
}
625+
assert arguments[1] instanceof Number;
626+
try {
627+
executeNode.execute(null, getDelegate(), toJavaNode.execute(arguments[0]), arguments[1], toJavaNode.execute(arguments[2]));
628+
return 0;
629+
} catch (Throwable t) {
630+
throw checkThrowableBeforeNative(t, "SsizeobjargfuncWrapper", getDelegate());
631+
}
632+
} catch (PException e) {
633+
transformExceptionToNativeNode.execute(null, inliningTarget, e);
634+
return -1;
635+
} finally {
636+
CApiTiming.exit(timing);
637+
gil.release(mustRelease);
638+
}
639+
}
640+
641+
@Override
642+
protected String getSignature() {
643+
return "(POINTER,SINT64,POINTER):SINT32";
644+
}
645+
}
646+
604647
@ExportLibrary(InteropLibrary.class)
605648
public static final class LenfuncWrapper extends PyProcsWrapper {
606649

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@
161161
import com.oracle.graal.python.builtins.objects.cext.capi.PyProcsWrapper.RichcmpFunctionWrapper;
162162
import com.oracle.graal.python.builtins.objects.cext.capi.PyProcsWrapper.SetAttrWrapper;
163163
import com.oracle.graal.python.builtins.objects.cext.capi.PyProcsWrapper.SsizeargfuncWrapper;
164+
import com.oracle.graal.python.builtins.objects.cext.capi.PyProcsWrapper.SsizeobjargfuncWrapper;
164165
import com.oracle.graal.python.builtins.objects.cext.capi.PyProcsWrapper.TernaryFunctionWrapper;
165166
import com.oracle.graal.python.builtins.objects.cext.capi.PyProcsWrapper.UnaryFuncWrapper;
166167
import com.oracle.graal.python.builtins.objects.cext.structs.CFields;
@@ -195,7 +196,7 @@ public enum SlotMethodDef {
195196

196197
SQ_LENGTH(PySequenceMethods__sq_length, T___LEN__, LenfuncWrapper::new, MethodsFlags.SQ_LENGTH),
197198
SQ_ITEM(PySequenceMethods__sq_item, T___GETITEM__, SsizeargfuncWrapper::new, MethodsFlags.SQ_ITEM),
198-
SQ_ASS_ITEM(PySequenceMethods__sq_ass_item, T___SETITEM__, SetAttrWrapper::new, MethodsFlags.SQ_ASS_ITEM),
199+
SQ_ASS_ITEM(PySequenceMethods__sq_ass_item, T___SETITEM__, SsizeobjargfuncWrapper::new, MethodsFlags.SQ_ASS_ITEM),
199200
SQ_REPEAT(PySequenceMethods__sq_repeat, T___MUL__, SsizeargfuncWrapper::new, MethodsFlags.SQ_REPEAT),
200201
SQ_CONCAT(PySequenceMethods__sq_concat, T___ADD__, BinaryFuncWrapper::new, MethodsFlags.SQ_CONCAT),
201202

0 commit comments

Comments
 (0)