| From: | Peter Eisentraut <peter(at)eisentraut(dot)org> |
|---|---|
| To: | Kirill Reshke <reshkekirill(at)gmail(dot)com> |
| Cc: | Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: PL/Python initialization cleanup |
| Date: | 2026-01-15 11:24:51 |
| Message-ID: | 4e1de244-b25a-4eae-9ee3-4993939cb4e7@eisentraut.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On 14.01.26 22:03, Kirill Reshke wrote:
> For 0004, do we need main_dict at all? it is only used inside _PG_init
> and then its value assigned to PLy_interp_globals...
This was merely a stylistic, defensive choice. I prefer to keep
main_dict in a local variable while it is being assembled, and only put
it into a global variable once it's done. This reduces the chance of
accidentally having a partially constructed object globally visible.
Another point is that main_dict is a borrowed reference, but when we put
it into the global variable we need to add another reference. Having
two separate variables makes this step more explicit.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Álvaro Herrera | 2026-01-15 11:26:23 | Re: Add missing JIT inline pass for llvm>=17 |
| Previous Message | Álvaro Herrera | 2026-01-15 11:22:41 | Re: Refactor replication origin state reset helpers |