Thread
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Add traceback information to PL/Python errors
- 2bd78eb8d51c 9.1.0 cited
-
pgsql: Add traceback information to PL/Python errors
Peter Eisentraut <peter_e@gmx.net> — 2011-04-06T19:37:22Z
Add traceback information to PL/Python errors This mimics the traceback information the Python interpreter prints with exceptions. Jan Urbański Branch ------ master Details ------- http://git.postgresql.org/pg/commitdiff/2bd78eb8d51cc9ee03ba0287b23ff4c266dcd9b9 Modified Files -------------- src/pl/plpython/expected/plpython_do.out | 5 +- src/pl/plpython/expected/plpython_error.out | 193 +++++++++++++++- src/pl/plpython/expected/plpython_error_0.out | 193 +++++++++++++++- .../plpython/expected/plpython_subtransaction.out | 55 ++++- .../expected/plpython_subtransaction_0.out | 30 ++- .../expected/plpython_subtransaction_5.out | 30 ++- src/pl/plpython/expected/plpython_test.out | 5 +- src/pl/plpython/expected/plpython_types.out | 5 +- src/pl/plpython/expected/plpython_types_3.out | 5 +- src/pl/plpython/plpython.c | 236 +++++++++++++++++--- src/pl/plpython/sql/plpython_error.sql | 105 +++++++++ 11 files changed, 786 insertions(+), 76 deletions(-)
-
Re: [COMMITTERS] pgsql: Add traceback information to PL/Python errors
Robert Haas <robertmhaas@gmail.com> — 2011-04-07T21:01:41Z
On Wed, Apr 6, 2011 at 3:37 PM, Peter Eisentraut <peter_e@gmx.net> wrote: > Add traceback information to PL/Python errors > > This mimics the traceback information the Python interpreter prints > with exceptions. > > Jan Urbański On my system this spits out a warning: plpython.c: In function ‘PLy_traceback’: plpython.c:4487: warning: ‘s’ may be used uninitialized in this function plpython.c:4487: note: ‘s’ was declared here That appears to be a live bug, unless it's guaranteed that lineno will always be > 0. Also, the loop test should really be written as current < lineno, rather than current != lineno, just in case we should manage to pass a lineno < 0, which with the current code would go into the tank and spin. This part looks pretty sketchy, too: while (s && isspace((unsigned char) *s)) s++; Perhaps we meant to test *s here. It's hard to believe that we're really intending to test whether the pointer has fallen off the end of the address space and wrapped around to NULL. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -
Re: [COMMITTERS] pgsql: Add traceback information to PL/Python errors
Jan Urbański <wulczer@wulczer.org> — 2011-04-07T21:06:38Z
On 07/04/11 23:01, Robert Haas wrote: > On Wed, Apr 6, 2011 at 3:37 PM, Peter Eisentraut <peter_e@gmx.net> wrote: >> Add traceback information to PL/Python errors >> >> This mimics the traceback information the Python interpreter prints >> with exceptions. >> >> Jan Urbański > > On my system this spits out a warning: > > plpython.c: In function ‘PLy_traceback’: > plpython.c:4487: warning: ‘s’ may be used uninitialized in this function > plpython.c:4487: note: ‘s’ was declared here > > That appears to be a live bug, unless it's guaranteed that lineno will > always be > 0. lineno should be > 0, unless Python is trying to tell us that the code frame originates from before the function. > Also, the loop test should really be written as current < lineno, > rather than current != lineno, just in case we should manage to pass a > lineno < 0, which with the current code would go into the tank and > spin. Yeah, good point. > This part looks pretty sketchy, too: > > while (s && isspace((unsigned char) *s)) > s++; > > Perhaps we meant to test *s here. It's hard to believe that we're > really intending to test whether the pointer has fallen off the end of > the address space and wrapped around to NULL. Gah, so short a function and so many things that I managed to get wrong. There's also this: http://archives.postgresql.org/pgsql-hackers/2011-04/msg00334.php Jan
-
Re: [COMMITTERS] pgsql: Add traceback information to PL/Python errors
Robert Haas <robertmhaas@gmail.com> — 2011-04-07T22:25:12Z
On Thu, Apr 7, 2011 at 5:06 PM, Jan Urbański <wulczer@wulczer.org> wrote: > On 07/04/11 23:01, Robert Haas wrote: >> On Wed, Apr 6, 2011 at 3:37 PM, Peter Eisentraut <peter_e@gmx.net> wrote: >>> Add traceback information to PL/Python errors >>> >>> This mimics the traceback information the Python interpreter prints >>> with exceptions. >>> >>> Jan Urbański >> >> On my system this spits out a warning: >> >> plpython.c: In function ‘PLy_traceback’: >> plpython.c:4487: warning: ‘s’ may be used uninitialized in this function >> plpython.c:4487: note: ‘s’ was declared here >> >> That appears to be a live bug, unless it's guaranteed that lineno will >> always be > 0. > > lineno should be > 0, unless Python is trying to tell us that the code > frame originates from before the function. > >> Also, the loop test should really be written as current < lineno, >> rather than current != lineno, just in case we should manage to pass a >> lineno < 0, which with the current code would go into the tank and >> spin. > > Yeah, good point. > >> This part looks pretty sketchy, too: >> >> while (s && isspace((unsigned char) *s)) >> s++; >> >> Perhaps we meant to test *s here. It's hard to believe that we're >> really intending to test whether the pointer has fallen off the end of >> the address space and wrapped around to NULL. > > Gah, so short a function and so many things that I managed to get wrong. Patch? > There's also this: > http://archives.postgresql.org/pgsql-hackers/2011-04/msg00334.php Yep. I am assuming Peter will look at that one. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
-
Re: [COMMITTERS] pgsql: Add traceback information to PL/Python errors
Jan Urbański <wulczer@wulczer.org> — 2011-04-07T22:39:40Z
On 08/04/11 00:25, Robert Haas wrote: > On Thu, Apr 7, 2011 at 5:06 PM, Jan Urbański <wulczer@wulczer.org> wrote: >> On 07/04/11 23:01, Robert Haas wrote: >>> On Wed, Apr 6, 2011 at 3:37 PM, Peter Eisentraut <peter_e@gmx.net> wrote: >>>> Add traceback information to PL/Python errors >>>> >>>> This mimics the traceback information the Python interpreter prints >>>> with exceptions. >>>> >>>> Jan Urbański >>> >>> On my system this spits out a warning: >>> >>> plpython.c: In function ‘PLy_traceback’: >>> plpython.c:4487: warning: ‘s’ may be used uninitialized in this function >>> plpython.c:4487: note: ‘s’ was declared here >>> >>> That appears to be a live bug, unless it's guaranteed that lineno will >>> always be > 0. >> >> lineno should be > 0, unless Python is trying to tell us that the code >> frame originates from before the function. >> >>> Also, the loop test should really be written as current < lineno, >>> rather than current != lineno, just in case we should manage to pass a >>> lineno < 0, which with the current code would go into the tank and >>> spin. >> >> Yeah, good point. >> >>> This part looks pretty sketchy, too: >>> >>> while (s && isspace((unsigned char) *s)) >>> s++; >>> >>> Perhaps we meant to test *s here. It's hard to believe that we're >>> really intending to test whether the pointer has fallen off the end of >>> the address space and wrapped around to NULL. >> >> Gah, so short a function and so many things that I managed to get wrong. > > Patch? Attached. >> There's also this: >> http://archives.postgresql.org/pgsql-hackers/2011-04/msg00334.php > > Yep. I am assuming Peter will look at that one. I guess so. This only fixes the things you noticed. Jan