File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -258,6 +258,9 @@ PyAPI_FUNC(void) _PyXI_Exit(_PyXI_session *session);
258
258
PyAPI_FUNC (void ) _PyXI_ApplyCapturedException (
259
259
_PyXI_session * session ,
260
260
PyObject * excwrapper );
261
+ PyAPI_FUNC (PyObject * ) _PyXI_ResolveCapturedException (
262
+ _PyXI_session * session ,
263
+ PyObject * excwrapper );
261
264
PyAPI_FUNC (int ) _PyXI_HasCapturedException (_PyXI_session * session );
262
265
263
266
Original file line number Diff line number Diff line change @@ -1414,6 +1414,26 @@ _PyXI_HasCapturedException(_PyXI_session *session)
1414
1414
return session -> exc != NULL ;
1415
1415
}
1416
1416
1417
+ PyObject *
1418
+ _PyXI_ResolveCapturedException (_PyXI_session * session , PyObject * excwrapper )
1419
+ {
1420
+ assert (!PyErr_Occurred ());
1421
+ assert (session -> exc != NULL );
1422
+ PyObject * snapshot = NULL ;
1423
+ if (session -> exc -> code == _PyXI_ERR_UNCAUGHT_EXCEPTION ) {
1424
+ snapshot = PyExceptionSnapshot_FromInfo (& session -> exc -> uncaught );
1425
+ if (snapshot == NULL ) {
1426
+ return NULL ;
1427
+ }
1428
+ assert (!PyErr_Occurred ());
1429
+ }
1430
+ else {
1431
+ _PyXI_ApplyCapturedException (session , excwrapper );
1432
+ assert (PyErr_Occurred ());
1433
+ }
1434
+ return snapshot ;
1435
+ }
1436
+
1417
1437
int
1418
1438
_PyXI_Enter (_PyXI_session * session ,
1419
1439
PyInterpreterState * interp , PyObject * nsupdates )
You can’t perform that action at this time.
0 commit comments