On 13.01.26 07:15, li carol wrote:
> I have applied and reviewed the v2 patch set. The cleanup of the initialization flow is a very good improvement and
makesthe logic much easier to follow.
> In particular, the updated comments in PLy_create_exception regarding the reference counting logic are very helpful
andclarify the previous ambiguity.
> I have one minor nitpick in plpy_main.c regarding consistency. In _PG_init(), the import and dictionary insertion of
the"plpy" module is currently split into two checks with the same error message. To make it more consistent with how
the__main__ module is handled earlier in the same function, we could potentially streamline it like this:
> /*
> * Import plpy.
> */
> plpy_mod = PyImport_ImportModule("plpy");
> if (plpy_mod == NULL || PyDict_SetItemString(main_dict, "plpy", plpy_mod) < 0)
> PLy_elog(ERROR, "could not import \"plpy\" module");
>
> This is just a small suggestion for style consistency; the existing logic in v2 is perfectly correct.
Thank you for this suggestion. I agree that having the same error
message for two different situations was not good. I changed the error
checking of PyDict_SetItemString() like you suggested here, but also
gave it a separate PLy_elog() call (without a message, since it's pretty
much "can't happen").
I committed the patches with this change.