Skip to content

Commit 75b92bd

Browse files
committed
Implement PyException_Get/SetArgs
1 parent 14c9a4b commit 75b92bd

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/cext/PythonCextErrBuiltins.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,4 +501,27 @@ Object setTraceback(Object exc, Object traceback,
501501
return 0;
502502
}
503503
}
504+
505+
@CApiBuiltin(ret = PyObjectTransfer, args = {PyObject}, call = Direct)
506+
abstract static class PyException_GetArgs extends CApiUnaryBuiltinNode {
507+
508+
@Specialization
509+
static Object get(Object exc,
510+
@Bind Node inliningTarget,
511+
@Cached ExceptionNodes.GetArgsNode getArgsNode) {
512+
return getArgsNode.execute(inliningTarget, exc);
513+
}
514+
}
515+
516+
@CApiBuiltin(ret = Void, args = {PyObject, PyObject}, call = Direct)
517+
abstract static class PyException_SetArgs extends CApiBinaryBuiltinNode {
518+
519+
@Specialization
520+
static Object set(PBaseException exc, PTuple args,
521+
@Bind Node inliningTarget,
522+
@Cached ExceptionNodes.SetArgsNode setArgsNode) {
523+
setArgsNode.execute(inliningTarget, exc, args);
524+
return PNone.NO_VALUE;
525+
}
526+
}
504527
}

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,8 +1262,6 @@ public final class CApiFunction {
12621262
@CApiBuiltin(name = "PyErr_SetRaisedException", ret = Void, args = {PyObjectRawPointer}, call = CImpl)
12631263
@CApiBuiltin(name = "PyEval_SetProfileAllThreads", ret = Void, args = {PY_TRACEFUNC, PyObjectRawPointer}, call = NotImplemented)
12641264
@CApiBuiltin(name = "PyEval_SetTraceAllThreads", ret = Void, args = {PY_TRACEFUNC, PyObjectRawPointer}, call = NotImplemented)
1265-
@CApiBuiltin(name = "PyException_GetArgs", ret = PyObjectRawPointer, args = {PyObjectRawPointer}, call = NotImplemented)
1266-
@CApiBuiltin(name = "PyException_SetArgs", ret = Void, args = {PyObjectRawPointer, PyObjectRawPointer}, call = NotImplemented)
12671265
@CApiBuiltin(name = "PyFrame_GetVar", ret = PyObjectRawPointer, args = {PyFrameObjectBorrowed, PyObjectRawPointer}, call = NotImplemented)
12681266
@CApiBuiltin(name = "PyFrame_GetVarString", ret = PyObjectRawPointer, args = {PyFrameObjectBorrowed, ConstCharPtr}, call = NotImplemented)
12691267
@CApiBuiltin(name = "PyFunction_AddWatcher", ret = PrimitiveResult32, args = {PyFunction_WatchCallback}, call = NotImplemented)

0 commit comments

Comments
 (0)