Re: pl/python do not delete function arguments - Mailing list pgsql-hackers

From Hitoshi Harada
Subject Re: pl/python do not delete function arguments
Date
Msg-id AANLkTinQuUXNrg4YO38P3viNj=Pr7HAkZgUaFdiYQ3Hn@mail.gmail.com
Whole thread Raw
In response to pl/python do not delete function arguments  (Jan Urbański <wulczer@wulczer.org>)
Responses Re: pl/python do not delete function arguments  (Jan Urbański <wulczer@wulczer.org>)
List pgsql-hackers
2010/12/31 Jan Urbański <wulczer@wulczer.org>:
> (continuing the flurry of patches)
>
> Here's a patch that stops PL/Python from removing the function's
> arguments from its globals dict after calling it. It's
> an incremental patch on top of the plpython-refactor patch sent in
> http://archives.postgresql.org/message-id/4D135170.3080705@wulczer.org.
>
> Git branch for this patch:
> https://github.com/wulczer/postgres/tree/dont-remove-arguments
>
> Apart from being useless, as the whole dict is unreffed and thus freed
> in PLy_procedure_delete, removing args actively breaks things for
> recursive invocation of the same function. The recursive callee after
> returning will remove the args from globals, and subsequent access to
> the arguments in the caller will cause a NameError (see new regression
> test in patch).

I've reviewed this. The patch is old enough to be rejected by patch
command, but I manged to apply it by hand.
It compiles clean. Added tests pass.
I created fibonacci function similar to recursion_test in the patch
and confirmed the recursion raises error on 9.0 but not on 9.1.
Doc is not with the patch since this change is to remove unnecessary
optimization internally.

"Ready for Committer"


Regards,



--
Hitoshi Harada


pgsql-hackers by date:

Previous
From: Fujii Masao
Date:
Subject: Re: [COMMITTERS] pgsql: Basic Recovery Control functions for use in Hot Standby. Pause,
Next
From: Joachim Wieland
Date:
Subject: Re: pg_dump directory archive format / parallel pg_dump