Displaying 3 results from an estimated 3 matches for "pyerr_print".
Did you mean:
pyerr_printex
2018 Apr 05
1
Re: [PATCH nbdkit] python: Turn python exceptions into nbdkit errors properly.
...));
instead of using the temporary variable r?
> static int
> check_python_failure (const char *callback)
> {
> if (PyErr_Occurred ()) {
> - nbdkit_error ("%s: callback failed: %s", script, callback);
> - /* How to turn this into a string? XXX */
> - PyErr_Print ();
> + PyObject *type, *error, *traceback, *error_str;
> + char *error_cstr;
> +
> + /* Convert the Python exception to a string.
> + * https://stackoverflow.com/a/1418703
> + * But forget about the traceback, it's very hard to print.
> + * https://sta...
2018 Apr 05
4
[PATCH nbdkit] python: Turn python exceptions into nbdkit errors
Much more annoying that it needs to be, but I have tested it and it
works on Python 2 & 3. Note this will not work on Python 3.0 - 3.2,
but I guess we don't care about those versions.
Rich.
2018 Apr 05
0
[PATCH nbdkit] python: Turn python exceptions into nbdkit errors properly.
...RING (str);
+ r = strdup (r);
+ return r;
+ }
+ }
+ return NULL;
+}
+
static int
check_python_failure (const char *callback)
{
if (PyErr_Occurred ()) {
- nbdkit_error ("%s: callback failed: %s", script, callback);
- /* How to turn this into a string? XXX */
- PyErr_Print ();
+ PyObject *type, *error, *traceback, *error_str;
+ char *error_cstr;
+
+ /* Convert the Python exception to a string.
+ * https://stackoverflow.com/a/1418703
+ * But forget about the traceback, it's very hard to print.
+ * https://stackoverflow.com/q/1796510
+ */
+...