[Cython] subclassing list

2011-05-24 Thread Vitja Makarov
cdef class Foo(list): pass def foo(): f = Foo() f.append(1) gcc -g3 -fPIC -I/usr/include/python2.6 -g3 -W -Wall-c -o lll.o lll.c lll.c: In function ‘__pyx_pf_3lll_foo’: lll.c:468: error: ‘struct __pyx_obj_3lll_Foo’ has no member named ‘None’ Is this a known bug? -- vitja. _

Re: [Cython] CF and finally clause

2011-05-24 Thread Stefan Behnel
Robert Bradshaw, 25.05.2011 01:30: On Tue, May 24, 2011 at 2:17 PM, Carl Witty wrote: On Tue, May 24, 2011 at 2:04 PM, Stefan Behnel wrote: I'm not so opposed to this proposal. I have been (idly and unfoundedly) wondering basically forever if the current way try-finally is implemented is actual

Re: [Cython] CF and finally clause

2011-05-24 Thread Robert Bradshaw
On Tue, May 24, 2011 at 2:17 PM, Carl Witty wrote: > On Tue, May 24, 2011 at 2:04 PM, Stefan Behnel wrote: >> I'm not so opposed to this proposal. I have been (idly and unfoundedly) >> wondering basically forever if the current way try-finally is implemented is >> actually a good one. I can accep

Re: [Cython] CF and finally clause

2011-05-24 Thread Carl Witty
On Tue, May 24, 2011 at 2:04 PM, Stefan Behnel wrote: > I'm not so opposed to this proposal. I have been (idly and unfoundedly) > wondering basically forever if the current way try-finally is implemented is > actually a good one. I can accept a performance penalty for the exception > case in both

Re: [Cython] Scope resolution in a Visitor

2011-05-24 Thread Stefan Behnel
Romain Guillebert, 24.05.2011 22:36: Sounds to me like you should attach the necessary information to the symbol table entry when analysing he "external" declaration. That's what I wanted to do that's why I asked how I could access the external declaration node Then you should have asked that

Re: [Cython] CF and finally clause

2011-05-24 Thread Stefan Behnel
Robert Bradshaw, 24.05.2011 22:07: On Tue, May 24, 2011 at 12:33 PM, Vitja Makarov wrote: When I create control flow graph I have to visit finally clause twice. This is required because of different outputs should be generated for success and exception case: try: a = might_raise() finally:

Re: [Cython] Scope resolution in a Visitor

2011-05-24 Thread Romain Guillebert
> Sounds to me like you should attach the necessary information to the > symbol table entry when analysing he "external" declaration. That's what I wanted to do that's why I asked how I could access the external declaration node > We currently store a "cname", so adding something like a property

Re: [Cython] Scope resolution in a Visitor

2011-05-24 Thread Stefan Behnel
Romain Guillebert, 24.05.2011 19:22: On Tue, May 24, 2011 at 06:56:19AM +0200, Stefan Behnel wrote: Romain Guillebert, 23.05.2011 20:33: I'm doing the PyPy backend for Cython Summer of Code project and I would like to know if there is a way of getting the AST Node responsible for the declaratio

Re: [Cython] CF and finally clause

2011-05-24 Thread Robert Bradshaw
On Tue, May 24, 2011 at 12:33 PM, Vitja Makarov wrote: > Hi! > > When I create control flow graph I have to visit finally clause twice. > This is required because of different outputs should be generated for > success and exception case: > > try: >    a = might_raise() > finally: >    pass # 'a' m

[Cython] CF and finally clause

2011-05-24 Thread Vitja Makarov
Hi! When I create control flow graph I have to visit finally clause twice. This is required because of different outputs should be generated for success and exception case: try: a = might_raise() finally: pass # 'a' might be uninitialized here print(a) # and definitely defined here So a

Re: [Cython] Scope resolution in a Visitor

2011-05-24 Thread Romain Guillebert
On Tue, May 24, 2011 at 06:56:19AM +0200, Stefan Behnel wrote: > Romain Guillebert, 23.05.2011 20:33: > >I'm doing the PyPy backend for Cython Summer of Code project and I would > >like to know if there is a way of getting the AST Node responsible for > >the declaration of a variable. > > > >For ex