This is a copy of _PyErr_ChainExceptions */
| 441 | /* This is a copy of _PyErr_ChainExceptions |
| 442 | */ |
| 443 | static inline void |
| 444 | npy_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: |
no outgoing calls
no test coverage detected