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.


---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Reply via email to