Re: plpython tracebacks

Поиск
Список
Период
Сортировка
От Neil Conway
Тема Re: plpython tracebacks
Дата
Msg-id 1140397749.2615.28.camel@localhost.localdomain
обсуждение исходный текст
Ответ на plpython tracebacks  ("P. Scott DeVos" <scott@countrysidetechnology.com>)
Ответы Re: plpython tracebacks  ("Harald Armin Massa" <haraldarminmassa@gmail.com>)
Re: plpython tracebacks  (daveg <daveg@sonic.net>)
Re: plpython tracebacks  ("P. Scott DeVos" <scott@countrysidetechnology.com>)
Список pgsql-patches
On Mon, 2006-02-06 at 16:05 -0600, P. Scott DeVos wrote:
> I have been working with plpython for several months and have
> been hampered by the lack of a traceback being logged when a
> plpython function raises an error.  I have written a patch causes
> the PLy_traceback function to fully log the traceback.  The
> output looks just like the traceback output provided by the
> python interpreter.

Can any PL/Python folks comment on whether they want this patch?

> Feedback appreciated.

Context diffs are preferred. Also, diffs should be against the root of
the source tree, and attached as MIME attachements if possible (it seems
the mailing list software munges the patch somewhat otherwise).

> +        hdr = PyString_FromString("Traceback (most recent call last):");
> +        tmpl = PyString_FromString("  File \"%s\", line %s, in %s");
> +        ftr = PyString_FromString("");
> +
> +        tb_list = PyList_New(0);     /* create the list of strings */
> +        PyList_Append(tb_list, hdr); /* Append the header to the list */

Minor nit: lowercase "Append". Similarly, consistent capitalization for
all the preceding comments in the block (adjacent to the variable
declarations) would be nice.

>       estr = eob ? PyString_AsString(eob) : "Unknown Exception";
> -    xstr = PLy_printf("%s: %s", estr, vstr);
> +    xstr = PLy_printf("%s%s: %s", tbstr, estr, vstr);

tbstr points into storage owned by tb_log, but the reference to tb_log
has already been released.

-Neil



В списке pgsql-patches по дате отправления:

Предыдущее
От: Neil Conway
Дата:
Сообщение: Re: ScanDirections
Следующее
От: James William Pye
Дата:
Сообщение: Re: ScanDirections