Re: PL/Python initialization cleanup

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: PL/Python initialization cleanup
Дата
Msg-id 4e1de244-b25a-4eae-9ee3-4993939cb4e7@eisentraut.org
обсуждение исходный текст
Ответ на Re: PL/Python initialization cleanup  (Kirill Reshke <reshkekirill@gmail.com>)
Список 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.




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