pgsql: Consistently catch errors from Python _New() functions

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема pgsql: Consistently catch errors from Python _New() functions
Дата
Msg-id E1eG826-0004jr-Jx@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
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(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Improve to_date/to_number/to_timestamp behavior with multibytec
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Merge near-duplicate code in RI triggers.