]> git.ipfire.org Git - thirdparty/postgresql.git/commit
plpython: Streamline initialization
authorPeter Eisentraut <peter@eisentraut.org>
Thu, 15 Jan 2026 11:11:52 +0000 (12:11 +0100)
committerPeter Eisentraut <peter@eisentraut.org>
Thu, 15 Jan 2026 11:11:52 +0000 (12:11 +0100)
commitda265a87175be469db6c178b57862ad1fb26dd04
tree7e817902109fb18e33916861f102fa149c74a6d9
parent3263a893fb1d2b36a44c13da701e44c805ed03f6
plpython: Streamline initialization

The initialization of PL/Python (the Python interpreter, the global
state, the plpy module) was arranged confusingly across different
functions with unclear and confusing boundaries.  For example,
PLy_init_interp() said "Initialize the Python interpreter ..." but it
didn't actually do this, and PLy_init_plpy() said "initialize plpy
module" but it didn't do that either.  After this change, all the
global initialization is called directly from _PG_init(), and the plpy
module initialization is all called from its registered initialization
function PyInit_plpy().

Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>
Reviewed-by: li carol <carol.li2025@outlook.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Discussion: https://www.postgresql.org/message-id/f31333f1-fbb7-4098-b209-bf2d71fbd4f3%40eisentraut.org
src/pl/plpython/plpy_main.c
src/pl/plpython/plpy_plpymodule.c
src/pl/plpython/plpy_plpymodule.h