MCPcopy Create free account
hub / github.com/numpy/numpy / npy_PyErr_ChainExceptions

Function npy_PyErr_ChainExceptions

numpy/core/include/numpy/npy_3kcompat.h:443–468  ·  view source on GitHub ↗

This is a copy of _PyErr_ChainExceptions */

Source from the content-addressed store, hash-verified

441/* This is a copy of _PyErr_ChainExceptions
442 */
443static inline void
444npy_PyErr_ChainExceptions(PyObject *exc, PyObject *val, PyObject *tb)
445{
446 if (exc == NULL)
447 return;
448
449 if (PyErr_Occurred()) {
450 /* only py3 supports this anyway */
451 #ifdef NPY_PY3K
452 PyObject *exc2, *val2, *tb2;
453 PyErr_Fetch(&exc2, &val2, &tb2);
454 PyErr_NormalizeException(&exc, &val, &tb);
455 if (tb != NULL) {
456 PyException_SetTraceback(val, tb);
457 Py_DECREF(tb);
458 }
459 Py_DECREF(exc);
460 PyErr_NormalizeException(&exc2, &val2, &tb2);
461 PyException_SetContext(val2, val);
462 PyErr_Restore(exc2, val2, tb2);
463 #endif
464 }
465 else {
466 PyErr_Restore(exc, val, tb);
467 }
468}
469
470
471/* This is a copy of _PyErr_ChainExceptions, with:

Callers 6

PyArray_ToFileObjectFunction · 0.85
array_tofileFunction · 0.85
array_fromfileFunction · 0.85
read_rowsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected