Commit 5e2dc4f7 authored by Robert Bradshaw's avatar Robert Bradshaw

Fix performance regression in exception tracebacks.

See #1719.
parent 85a2dfe7
......@@ -603,10 +603,19 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line,
PyObject *use_cline = 0;
PyObject *ptype, *pvalue, *ptraceback;
static PyObject* cline_in_traceback = NULL;
if (cline_in_traceback == NULL) {
cline_in_traceback = PyString_InternFromString("cline_in_traceback");
}
if (c_line) {
PyErr_Fetch(&ptype, &pvalue, &ptraceback);
use_cline = PyObject_GetAttrString(${cython_runtime_cname}, "cline_in_traceback");
if (use_cline == NULL || PyObject_Not(use_cline) != 0) {
use_cline = PyObject_GetAttr(${cython_runtime_cname}, cline_in_traceback);
if (use_cline == NULL) {
c_line = 0;
PyObject_SetAttr(${cython_runtime_cname}, cline_in_traceback, Py_False);
}
else if (PyObject_Not(use_cline) != 0) {
c_line = 0;
}
PyErr_Restore(ptype, pvalue, ptraceback);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment