[Cython] failure of withstat
Dag Sverre Seljebotn
dagss at student.matnat.uio.no
Tue Feb 10 16:07:41 CET 2009
Lisandro Dalcin wrote:
> On Tue, Feb 10, 2009 at 12:22 PM, Dag Sverre Seljebotn
> <dagss at student.matnat.uio.no> wrote:
>
>> Ah. Yes, I noticed, but after commenting on the ticket. So apparently it
>> is NOT a C++-only issue, but something much more strange going on ...
>>
>>
>
> Indeed. It seems Cython 'memoizes' counters for a module context, then
> if you compile twice, the counters are not reinitialized. Or somethig
> like that....
>
> You know, module or class level globals could be rally evil :-) ...
>
> $ cd Cython/Compiler/
> $ find . -type f -print0 | xargs -0 -e grep -nH -e
> TemplateTransform.temp_name_counter
> ./ParseTreeTransforms.py:549: TemplateTransform.temp_name_counter += 1
> ./ParseTreeTransforms.py:550: handle = "__tmpvar_%d" %
> TemplateTransform.temp_name_counter
> ./TreeFragment.py:122: TemplateTransform.temp_name_counter += 1
> ./TreeFragment.py:123: handle = "__tmpvar_%d" %
> TemplateTransform.temp_name_counter
>
> Is the .temp_name_counter counter ever decremented? Could be this the
> root of the problem?
>
I tried binding temp_name_counter to Main.Context (which is available as
self.context in WithTransform), and initializing it to 0. It made no
difference (and I haven't got around to commiting that).
Dag Sverre
More information about the Cython-dev
mailing list