Skip to content

Commit e870f47

Browse files
committed
add _PyErr_Occurred
1 parent c3a61fd commit e870f47

File tree

6 files changed

+85
-56
lines changed

6 files changed

+85
-56
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2440,6 +2440,10 @@ PyAPI_FUNC(int) _PyDict_SetItem_KnownHash(PyObject* a, PyObject* b, PyObject* c,
24402440
PyAPI_FUNC(void) _PyErr_BadInternalCall(const char* a, int b) {
24412441
Graal_PyErr_BadInternalCall(truffleString(a), b);
24422442
}
2443+
#undef _PyErr_Occurred
2444+
PyAPI_FUNC(PyObject*) _PyErr_Occurred(PyThreadState* a) {
2445+
return Graal_PyErr_Occurred(a);
2446+
}
24432447
#undef _PyErr_WriteUnraisableMsg
24442448
PyAPI_FUNC(void) _PyErr_WriteUnraisableMsg(const char* a, PyObject* b) {
24452449
Graal_PyErr_WriteUnraisableMsg(truffleString(a), b);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,7 @@ typedef struct {
617617
BUILTIN(_PyDict_Pop, PyObject*, PyObject*, PyObject*, PyObject*) \
618618
BUILTIN(_PyDict_SetItem_KnownHash, int, PyObject*, PyObject*, PyObject*, Py_hash_t) \
619619
BUILTIN(_PyErr_BadInternalCall, void, const char*, int) \
620+
BUILTIN(_PyErr_Occurred, PyObject*, PyThreadState*) \
620621
BUILTIN(_PyErr_WriteUnraisableMsg, void, const char*, PyObject*) \
621622
BUILTIN(_PyList_Extend, PyObject*, PyListObject*, PyObject*) \
622623
BUILTIN(_PyList_SET_ITEM, void, PyObject*, Py_ssize_t, PyObject*) \

graalpython/com.oracle.graal.python.jni/src/capi_forwards.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,6 +1305,7 @@ void unimplemented(const char* name) {
13051305
#undef _PyErr_FormatFromCause
13061306
#undef _PyErr_GetExcInfo
13071307
#undef _PyErr_GetTopmostException
1308+
#undef _PyErr_Occurred
13081309
#undef _PyErr_ProgramDecodedTextObject
13091310
#undef _PyErr_SetKeyError
13101311
#undef _PyErr_TrySetFromCause
@@ -5009,6 +5010,10 @@ PyAPI_FUNC(void) _PyErr_GetExcInfo(PyThreadState* a, PyObject** b, PyObject** c,
50095010
PyAPI_FUNC(_PyErr_StackItem*) _PyErr_GetTopmostException(PyThreadState* a) {
50105011
unimplemented("_PyErr_GetTopmostException"); exit(-1);
50115012
}
5013+
PyAPI_FUNC(PyObject*) _PyErr_Occurred(PyThreadState* a) {
5014+
PyObject* result = (PyObject*) Graal_PyErr_Occurred(a);
5015+
return result;
5016+
}
50125017
PyAPI_FUNC(PyObject*) _PyErr_ProgramDecodedTextObject(PyObject* a, int b, const char* c) {
50135018
unimplemented("_PyErr_ProgramDecodedTextObject"); exit(-1);
50145019
}

0 commit comments

Comments
 (0)