From: Peter Eisentraut <peter_e@gmx.net>
To: pgsql-committers@postgresql.org
Subject: pgsql: Consistently catch errors from Python _New() functions
Date: Sat, 18 Nov 2017 18:40:02 +0000
Message-ID: <E1eG826-0004jr-Jx@gemulon.postgresql.org> (raw)
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>
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/d0aa965c0a0ac2ff7906ae1b1dad50a7952efa56
Modified Files
--------------
contrib/hstore_plpython/hstore_plpython.c | 4 ++++
contrib/ltree_plpython/ltree_plpython.c | 4 ++++
src/pl/plpython/plpy_cursorobject.c | 25 ++++++++++++++++---------
src/pl/plpython/plpy_exec.c | 10 +++++++++-
src/pl/plpython/plpy_main.c | 2 +-
src/pl/plpython/plpy_plpymodule.c | 4 ++--
src/pl/plpython/plpy_procedure.c | 2 ++
src/pl/plpython/plpy_resultobject.c | 11 +++++++++++
src/pl/plpython/plpy_spi.c | 27 ++++++++++++++++++---------
src/pl/plpython/plpy_typeio.c | 4 +++-
10 files changed, 70 insertions(+), 23 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: peter_e@gmx.net
Subject: Re: pgsql: Consistently catch errors from Python _New() functions
In-Reply-To: <E1eG826-0004jr-Jx@gemulon.postgresql.org>
References: <E1eG826-0004jr-Jx@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox