search for: print_python_traceback

Displaying 5 results from an estimated 5 matches for "print_python_traceback".

2019 Nov 23
1
[PATCH nbdkit] python: Print readable tracebacks
...t;) RuntimeError: this is the test string --- plugins/python/python.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/python/python.c b/plugins/python/python.c index 148097f..71fa2e3 100644 --- a/plugins/python/python.c +++ b/plugins/python/python.c @@ -167,7 +167,7 @@ print_python_traceback (const char *callback, type, error, traceback, NULL); if (rv == NULL) return -1; - traceback_str = PyObject_Str (rv); + traceback_str = PyUnicode_Join (NULL, rv); Py_DECREF (rv); traceback_cstr = python_to_string (traceback_str); if (tracebac...
2018 Aug 08
2
[PATCH nbdkit] python: Try harder to print the full traceback on error.
...t;, + script, callback, + error_cstr ? error_cstr : "<unknown>"); + Py_DECREF (error_str); + free (error_cstr); +} + +/* Convert the Python traceback to a string and call nbdkit_error. + * https://stackoverflow.com/a/15907460/7126113 + */ +static int +print_python_traceback (const char *callback, + PyObject *type, PyObject *error, PyObject *traceback) +{ + PyObject *module_name, *traceback_module, *format_exception_fn, *rv, + *traceback_str; + char *traceback_cstr; + +#ifdef HAVE_PYSTRING_FROMSTRING + module_name = PyString_FromString (&qu...
2018 Aug 08
0
Re: [PATCH nbdkit] python: Try harder to print the full traceback on error.
...error_cstr ? error_cstr : "<unknown>"); > + Py_DECREF (error_str); > + free (error_cstr); > +} > + > +/* Convert the Python traceback to a string and call nbdkit_error. > + * https://stackoverflow.com/a/15907460/7126113 > + */ > +static int > +print_python_traceback (const char *callback, > + PyObject *type, PyObject *error, PyObject > *traceback) > +{ > + PyObject *module_name, *traceback_module, *format_exception_fn, *rv, > + *traceback_str; > + char *traceback_cstr; > + > +#ifdef HAVE_PYSTRING_FROMSTRING &...
2019 Sep 11
0
[PATCH nbdkit] python: Drop support for Python 2.
...else -#endif -#ifdef HAVE_PYSTRING_ASSTRING - if (PyString_Check (str)) - return strdup (PyString_AsString (str)); - else -#endif - if (PyBytes_Check (str)) + else if (PyBytes_Check (str)) return strdup (PyBytes_AS_STRING (str)); } return NULL; @@ -159,11 +151,7 @@ print_python_traceback (const char *callback, *traceback_str; CLEANUP_FREE char *traceback_cstr = NULL; -#ifdef HAVE_PYSTRING_FROMSTRING - module_name = PyString_FromString ("traceback"); -#else module_name = PyUnicode_FromString ("traceback"); -#endif traceback_module = PyImport_Impo...
2019 Sep 11
3
[PATCH nbdkit] python: Drop support for Python 2.
This patch proposes to drop support for Python 2 in nbdkit. Rather than abruptly drop it everywhere, my proposal is that we point people to nbdkit 1.14 (the current stable version) if they want to continue with Python 2 plugins, while gently reminding them of the upcoming Python 2.7 end of life announcement. Libnbd never supported Python 2. Libguestfs in theory supports Python 2 but I dropped