Displaying 5 results from an estimated 5 matches for "traceback_cstr".
2018 Aug 08
2
[PATCH nbdkit] python: Try harder to print the full traceback on error.
...r.
+ * 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 ("traceback");
+#else
+ module_name = PyUnicode_FromString ("traceback");
+#endif
+ traceback_module = PyImport_Import (module_name);
+ Py_DECREF (module_name);
+
+ /* couldn't 'import traceback...
2019 Nov 23
1
[PATCH nbdkit] python: Print readable tracebacks
...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 (traceback_cstr == NULL) {
--
2.21.0
2018 Aug 08
0
Re: [PATCH nbdkit] python: Try harder to print the full traceback on error.
...126113
> + */
> +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 ("traceback");
> +#else
> + module_name = PyUnicode_FromString ("traceback");
> +#endif
> + traceback_module = PyImport_Import (module_name);
> + Py_DECREF (module_name);
&g...
2019 Sep 11
0
[PATCH nbdkit] python: Drop support for Python 2.
...urn 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_Import (module_name);
Py_DECREF (module_name);
@@ -222,7 +210,6 @@ check_python_...
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