Re: codlin_month is up and complain - PL/Python crash - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: codlin_month is up and complain - PL/Python crash
Date
Msg-id 1266423350.3539.10.camel@vanquo.pezone.net
Whole thread Raw
In response to Re: codlin_month is up and complain - PL/Python crash  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: codlin_month is up and complain - PL/Python crash
List pgsql-hackers
On ons, 2010-02-17 at 11:05 -0500, Tom Lane wrote:
> All of the MemoryContextSwitchTo calls in plpython seem to be in
> patterns like this:
> 
>     MemoryContext oldcontext;
> 
>     oldcontext = CurrentMemoryContext;
>     PG_TRY();
>     {
>         ... do something ...
>     }
>     PG_CATCH();
>     {
>         MemoryContextSwitchTo(oldcontext);
> 
> Since oldcontext is only set in the one place, it really shouldn't
> require "volatile" decoration, but maybe it does.

It is my understanding that local automatic variables may be clobbered
by [sig]longjmp unless they are marked volatile.  The PG_CATCH branch is
reached by means of a [sig]longjmp.  So that would mean that any
variable that you want to use both before the TRY and inside the CATCH
has to be volatile.




pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: codlin_month is up and complain - PL/Python crash
Next
From: Tom Lane
Date:
Subject: Re: codlin_month is up and complain - PL/Python crash