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.