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 @@ -1584,6 +1584,26 @@ _PyXI_HasCapturedException(_PyXI_session *session)
1584
1584
return session -> exc != NULL ;
1585
1585
}
1586
1586
1587
+ PyObject *
1588
+ _PyXI_ResolveCapturedException (_PyXI_session * session , PyObject * excwrapper )
1589
+ {
1590
+ assert (!PyErr_Occurred ());
1591
+ assert (session -> exc != NULL );
1592
+ PyObject * snapshot = NULL ;
1593
+ if (session -> exc -> code == _PyXI_ERR_UNCAUGHT_EXCEPTION ) {
1594
+ snapshot = PyExceptionSnapshot_FromInfo (& session -> exc -> uncaught );
1595
+ if (snapshot == NULL ) {
1596
+ return NULL ;
1597
+ }
1598
+ assert (!PyErr_Occurred ());
1599
+ }
1600
+ else {
1601
+ _PyXI_ApplyCapturedException (session , excwrapper );
1602
+ assert (PyErr_Occurred ());
1603
+ }
1604
+ return snapshot ;
1605
+ }
1606
+
1587
1607
int
1588
1608
_PyXI_Enter (_PyXI_session * session ,
1589
1609
PyInterpreterState * interp , PyObject * nsupdates )
You can’t perform that action at this time.
0 commit comments