Fix freshly-introduced PL/Python portability bug.
authorTom Lane <[email protected]>
Mon, 11 Apr 2016 22:17:02 +0000 (18:17 -0400)
committerTom Lane <[email protected]>
Mon, 11 Apr 2016 22:17:02 +0000 (18:17 -0400)
commitf6b81162c5fc83f51921d8184bad5248c5eb1144
tree3d771d2adb5d56ae673949fd7934eaf770b4c5ad
parent8d82e6e28e22edf8082810dbba137c7f400af7b8
Fix freshly-introduced PL/Python portability bug.

It turns out that those PyErr_Clear() calls I removed from plpy_elog.c
in 7e3bb080387f4143 et al were not quite as random as they appeared: they
mask a Python 2.3.x bug.  (Specifically, it turns out that PyType_Ready()
can fail if the error indicator is set on entry, and PLy_traceback's fetch
of frame.f_code may be the first operation in a session that requires the
"frame" type to be readied.  Ick.)  Put back the clear call, but in a more
centralized place closer to what it's protecting, and this time with a
comment warning what it's really for.

Per buildfarm member prairiedog.  Although prairiedog was only failing
on HEAD, it seems clearly possible for this to occur in older branches
as well, so back-patch to 9.2 the same as the previous patch.
src/pl/plpython/plpy_elog.c