aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/pl/plpython/plpy_elog.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/pl/plpython/plpy_elog.c b/src/pl/plpython/plpy_elog.c
index 7d3d0d49816..7495e7d51dc 100644
--- a/src/pl/plpython/plpy_elog.c
+++ b/src/pl/plpython/plpy_elog.c
@@ -255,6 +255,12 @@ PLy_traceback(PyObject *e, PyObject *v, PyObject *tb,
PG_TRY();
{
+ /*
+ * Ancient versions of Python (circa 2.3) contain a bug whereby
+ * the fetches below can fail if the error indicator is set.
+ */
+ PyErr_Clear();
+
lineno = PyObject_GetAttrString(tb, "tb_lineno");
if (lineno == NULL)
elog(ERROR, "could not get line number from Python traceback");