search for: pyobject_str

Displaying 6 results from an estimated 6 matches for "pyobject_str".

2018 Aug 08
2
[PATCH nbdkit] python: Try harder to print the full traceback on error.
The tracebacks are compressed into a single line because we're using PyObject_Str, but they are just about usable if not very readable. For example you would see an error like this: nbdkit: error: ./python-exception.py: config_complete: error: ['Traceback (most recent call last):\n', ' File "./python-exception.py", line 54, in config_complete\n raise_e...
2018 Aug 08
0
Re: [PATCH nbdkit] python: Try harder to print the full traceback on error.
On Wed, Aug 8, 2018 at 4:07 PM Richard W.M. Jones <rjones@redhat.com> wrote: > The tracebacks are compressed into a single line because we're using > PyObject_Str, but they are just about usable if not very readable. > For example you would see an error like this: > > nbdkit: error: ./python-exception.py: config_complete: error: ['Traceback > (most recent call last):\n', ' File "./python-exception.py", line 54, in > conf...
2019 Nov 23
1
[PATCH nbdkit] python: Print readable tracebacks
...gins/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 (traceback_cstr == NULL) { -- 2.21.0
2018 Apr 05
1
Re: [PATCH nbdkit] python: Turn python exceptions into nbdkit errors properly.
...3 > + * But forget about the traceback, it's very hard to print. > + * https://stackoverflow.com/q/1796510 > + */ > + PyErr_Fetch (&type, &error, &traceback); > + PyErr_NormalizeException (&type, &error, &traceback); > + error_str = PyObject_Str (error); > + error_cstr = python_to_string (error_str); > + nbdkit_error ("%s: %s: error: %s", > + script, callback, error_cstr ? : "<unknown>"); Okay, not the first use of that gcc extension. Looks reasonable to me. -- Eric Blake, Princ...
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.
...s://stackoverflow.com/a/1418703 + * But forget about the traceback, it's very hard to print. + * https://stackoverflow.com/q/1796510 + */ + PyErr_Fetch (&type, &error, &traceback); + PyErr_NormalizeException (&type, &error, &traceback); + error_str = PyObject_Str (error); + error_cstr = python_to_string (error_str); + nbdkit_error ("%s: %s: error: %s", + script, callback, error_cstr ? : "<unknown>"); + Py_DECREF (error_str); + free (error_cstr); return -1; } return 0; diff --git a/tests/Makef...