pgsql: plpython: Clean up PyModule_AddObject() uses

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: plpython: Clean up PyModule_AddObject() uses
Date: 2026-01-15 09:58:20
Message-ID: E1vgK7Q-000aBh-0O@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

plpython: Clean up PyModule_AddObject() uses

The comments "PyModule_AddObject does not add a refcount to the
object, for some odd reason" seem distracting. Arguably, this
behavior is expected, not odd. Also, the additional references
created by the existing code are apparently not necessary. But we
should clean up the reference in the error case, as suggested by the
Python documentation.

Reviewed-by: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Reviewed-by: Matheus Alcantara <matheusssilv97(at)gmail(dot)com>
Reviewed-by: li carol <carol(dot)li2025(at)outlook(dot)com>
Reviewed-by: Kirill Reshke <reshkekirill(at)gmail(dot)com>
Discussion: https://www.postgresql.org/message-id/f31333f1-fbb7-4098-b209-bf2d71fbd4f3%40eisentraut.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/34d8111c3abe97daea014f5587f405cde00d9e48

Modified Files
--------------
src/pl/plpython/plpy_plpymodule.c | 43 ++++++++++++++++++++-------------------
1 file changed, 22 insertions(+), 21 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2026-01-15 11:16:46 pgsql: plpython: Streamline initialization
Previous Message Peter Eisentraut 2026-01-15 09:36:01 Re: pgsql: Enable Python Limited API for PL/Python on MSVC