Commit 25b65f76 authored by Robert Bradshaw's avatar Robert Bradshaw

Traceback on unraisable exceptions.

parent b65f48f9
......@@ -79,17 +79,17 @@ class UtilityCodeBase(object):
Code sections in the file can be specified as follows:
##### MyUtility.proto #####
[proto declarations]
##### MyUtility.init #####
[code run at module initialization]
##### MyUtility #####
#@requires: MyOtherUtility
#@substitute: naming
[definitions]
for prototypes and implementation respectively. For non-python or
......@@ -2077,9 +2077,10 @@ class CCodeWriter(object):
Naming.clineno_cname,
Naming.lineno_cname,
Naming.filename_cname,
int(self.globalstate.directives['unraisable_tracebacks'])
)
self.funcstate.uses_error_indicator = True
self.putln('__Pyx_WriteUnraisable("%s", %s, %s, %s);' % format_tuple)
self.putln('__Pyx_WriteUnraisable("%s", %s, %s, %s, %s);' % format_tuple)
self.globalstate.use_utility_code(
UtilityCode.load_cached("WriteUnraisableException", "Exceptions.c"))
......
......@@ -112,6 +112,7 @@ directive_defaults = {
'c_string_type': 'bytes',
'c_string_encoding': '',
'type_version_tag': True, # enables Py_TPFLAGS_HAVE_VERSION_TAG on extension types
'unraisable_tracebacks': False,
# set __file__ and/or __path__ to known source/target path at import time (instead of not having them available)
'set_initial_path' : None, # SOURCEFILE or "/full/path/to/module"
......
......@@ -417,16 +417,22 @@ static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value,
/////////////// WriteUnraisableException.proto ///////////////
static void __Pyx_WriteUnraisable(const char *name, int clineno,
int lineno, const char *filename); /*proto*/
int lineno, const char *filename,
int full_traceback); /*proto*/
/////////////// WriteUnraisableException ///////////////
//@requires: PyErrFetchRestore
static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) {
CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
int full_traceback) {
PyObject *old_exc, *old_val, *old_tb;
PyObject *ctx;
__Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
if (full_traceback) {
__Pyx_ErrRestore(old_exc, old_val, old_tb);
PyErr_PrintEx(1);
}
#if PY_MAJOR_VERSION < 3
ctx = PyString_FromString(name);
#else
......
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