Skip to content

Commit e2e961c

Browse files
committed
Avoid upcall in _PyErr_Occurred
1 parent 2f9c211 commit e2e961c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

graalpython/com.oracle.graal.python.cext/include/internal/pycore_pyerrors.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ extern void _PyErr_FiniTypes(PyInterpreterState *);
2424

2525
static inline PyObject* _PyErr_Occurred(PyThreadState *tstate)
2626
{
27+
assert(tstate != NULL);
2728
// GraalPy change
28-
return PyErr_Occurred();
29+
assert(tstate->curexc_type == _PyTruffleErr_Occurred(tstate));
30+
return tstate->curexc_type;
2931
}
3032

3133
static inline void _PyErr_ClearExcState(_PyErr_StackItem *exc_state)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ PyErr_SetString(PyObject *exception, const char *string)
162162
}
163163

164164

165-
#if 0 // GraalPy change
166165
PyObject* _Py_HOT_FUNCTION
167166
PyErr_Occurred(void)
168167
{
@@ -174,6 +173,7 @@ PyErr_Occurred(void)
174173
}
175174

176175

176+
#if 0 // GraalPy change
177177
int
178178
PyErr_GivenExceptionMatches(PyObject *err, PyObject *exc)
179179
{

0 commit comments

Comments
 (0)