Skip to content

Commit f1aa9d2

Browse files
committed
add PyErr_WarnExplicit
1 parent f207865 commit f1aa9d2

File tree

6 files changed

+1104
-1070
lines changed

6 files changed

+1104
-1070
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
@@ -1629,6 +1629,10 @@ PyAPI_FUNC(void) PyErr_Restore(PyObject* a, PyObject* b, PyObject* c) {
16291629
PyAPI_FUNC(void) PyErr_SetExcInfo(PyObject* a, PyObject* b, PyObject* c) {
16301630
GraalPyErr_SetExcInfo(a, b, c);
16311631
}
1632+
#undef PyErr_WarnExplicit
1633+
PyAPI_FUNC(int) PyErr_WarnExplicit(PyObject* a, const char* b, const char* c, int d, const char* e, PyObject* f) {
1634+
return GraalPyErr_WarnExplicit(a, truffleString(b), truffleString(c), d, truffleString(e), f);
1635+
}
16321636
#undef PyEval_GetBuiltins
16331637
PyAPI_FUNC(PyObject*) PyEval_GetBuiltins() {
16341638
return GraalPyEval_GetBuiltins();

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ typedef struct {
145145
BUILTIN(PyErr_PrintEx, void, int) \
146146
BUILTIN(PyErr_Restore, void, PyObject*, PyObject*, PyObject*) \
147147
BUILTIN(PyErr_SetExcInfo, void, PyObject*, PyObject*, PyObject*) \
148+
BUILTIN(PyErr_WarnExplicit, int, PyObject*, const char*, const char*, int, const char*, PyObject*) \
148149
BUILTIN(PyEval_GetBuiltins, PyObject*) \
149150
BUILTIN(PyEval_RestoreThread, void, PyThreadState*) \
150151
BUILTIN(PyEval_SaveThread, PyThreadState*) \

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2284,8 +2284,10 @@ PyAPI_FUNC(void) PyErr_SyntaxLocationEx(const char* a, int b, int c) {
22842284
PyAPI_FUNC(void) PyErr_SyntaxLocationObject(PyObject* a, int b, int c) {
22852285
unimplemented("PyErr_SyntaxLocationObject"); exit(-1);
22862286
}
2287+
int (*__target__PyErr_WarnExplicit)(PyObject*, const char*, const char*, int, const char*, PyObject*) = NULL;
22872288
PyAPI_FUNC(int) PyErr_WarnExplicit(PyObject* a, const char* b, const char* c, int d, const char* e, PyObject* f) {
2288-
unimplemented("PyErr_WarnExplicit"); exit(-1);
2289+
int result = (int) __target__PyErr_WarnExplicit(a, b, c, d, e, f);
2290+
return result;
22892291
}
22902292
PyAPI_FUNC(int) PyErr_WarnExplicitFormat(PyObject* a, const char* b, int c, const char* d, PyObject* e, const char* f, ...) {
22912293
unimplemented("PyErr_WarnExplicitFormat"); exit(-1);
@@ -6245,6 +6247,7 @@ void initializeCAPIForwards(void* (*getAPI)(const char*)) {
62456247
__target__PyErr_SetNone = getAPI("PyErr_SetNone");
62466248
__target__PyErr_SetObject = getAPI("PyErr_SetObject");
62476249
__target__PyErr_SetString = getAPI("PyErr_SetString");
6250+
__target__PyErr_WarnExplicit = getAPI("PyErr_WarnExplicit");
62486251
__target__PyErr_WriteUnraisable = getAPI("PyErr_WriteUnraisable");
62496252
__target__PyEval_CallObjectWithKeywords = getAPI("PyEval_CallObjectWithKeywords");
62506253
__target__PyEval_EvalCode = getAPI("PyEval_EvalCode");

0 commit comments

Comments
 (0)