]> granicus.if.org Git - postgresql/commit
Consistently catch errors from Python _New() functions
authorPeter Eisentraut <peter_e@gmx.net>
Tue, 31 Oct 2017 14:49:36 +0000 (10:49 -0400)
committerPeter Eisentraut <peter_e@gmx.net>
Sat, 18 Nov 2017 18:39:53 +0000 (13:39 -0500)
commitd0aa965c0a0ac2ff7906ae1b1dad50a7952efa56
tree0a464efb705e7df59aefb68bb7cbcba3772fb9fa
parent976a1a48fc35cde3c750982be64f872c4de4d343
Consistently catch errors from Python _New() functions

Python Py*_New() functions can fail and return NULL in out-of-memory
conditions.  The previous code handled that inconsistently or not at
all.  This change organizes that better.  If we are in a function that
is called from Python, we just check for failure and return NULL
ourselves, which will cause any exception information to be passed up.
If we are called from PostgreSQL, we consistently create an "out of
memory" error.

Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
contrib/hstore_plpython/hstore_plpython.c
contrib/ltree_plpython/ltree_plpython.c
src/pl/plpython/plpy_cursorobject.c
src/pl/plpython/plpy_exec.c
src/pl/plpython/plpy_main.c
src/pl/plpython/plpy_plpymodule.c
src/pl/plpython/plpy_procedure.c
src/pl/plpython/plpy_resultobject.c
src/pl/plpython/plpy_spi.c
src/pl/plpython/plpy_typeio.c