Re: [Cython] BUG: Cython's dies with AttributeError

2011-07-19 Thread Robert Bradshaw
On Thu, Jul 7, 2011 at 2:25 PM, Lars Buitinck  wrote:
> Dear developers,
>
> I just got an error message from Cython (current Git). The error can
> be reproduced by putting
>
> cdef foo(): pass
>
> in a file called foo.pyx, and compiling that. (I know there's an error
> in the file as well.) Would you kindly look into this bug? The error
> message was:
>
>
> foo.pyx:1:9: Compiler crash in PostParse

I'm unable to reproduce this error, perhaps there's something missing
in the example here?

> ModuleNode.body = StatListNode(foo.pyx:1:5)
> StatListNode.stats[0] = CFuncDefNode(foo.pyx:1:5,
>    modifiers = [...]/0,
>    visibility = u'private')
> CFuncDefNode.declarator = CFuncDeclaratorNode(foo.pyx:1:9,
>    calling_convention = '')
> CFuncDeclaratorNode.base = CNameDeclaratorNode(foo.pyx:1:9,
>    calling_convention = u'',
>    name = u'foo')
>
> Compiler crash traceback from this point on:
>  File "Visitor.py", line 173, in
> Cython.Compiler.Visitor.TreeVisitor._visitchild
> (/home/s1254871/src/cython/Cython/Compiler/Visitor.c:3550)
>  File "Visitor.py", line 282, in
> Cython.Compiler.Visitor.CythonTransform.visit_Node
> (/home/s1254871/src/cython/Cython/Compiler/Visitor.c:5242)
>  File "Visitor.py", line 234, in
> Cython.Compiler.Visitor.VisitorTransform.visitchildren
> (/home/s1254871/src/cython/Cython/Compiler/Visitor.c:4395)
>  File "Visitor.py", line 202, in
> Cython.Compiler.Visitor.TreeVisitor._visitchildren
> (/home/s1254871/src/cython/Cython/Compiler/Visitor.c:4076)
> AttributeError: 'CNameDeclaratorNode' object has no attribute 'base'
> foo.pyx:1:9: Compiler crash in PostParse
>
> ModuleNode.body = StatListNode(foo.pyx:1:5)
> StatListNode.stats[0] = CFuncDefNode(foo.pyx:1:5,
>    modifiers = [...]/0,
>    visibility = u'private')
> CFuncDefNode.declarator = CFuncDeclaratorNode(foo.pyx:1:9,
>    calling_convention = '')
> CFuncDeclaratorNode.base = CNameDeclaratorNode(foo.pyx:1:9,
>    calling_convention = u'',
>    name = u'foo')
>
> Compiler crash traceback from this point on:
>  File "Visitor.py", line 173, in
> Cython.Compiler.Visitor.TreeVisitor._visitchild
> (/home/s1254871/src/cython/Cython/Compiler/Visitor.c:3550)
>  File "Visitor.py", line 282, in
> Cython.Compiler.Visitor.CythonTransform.visit_Node
> (/home/s1254871/src/cython/Cython/Compiler/Visitor.c:5242)
>  File "Visitor.py", line 234, in
> Cython.Compiler.Visitor.VisitorTransform.visitchildren
> (/home/s1254871/src/cython/Cython/Compiler/Visitor.c:4395)
>  File "Visitor.py", line 202, in
> Cython.Compiler.Visitor.TreeVisitor._visitchildren
> (/home/s1254871/src/cython/Cython/Compiler/Visitor.c:4076)
> AttributeError: 'CNameDeclaratorNode' object has no attribute 'base'
>
>
> --
> Lars Buitinck
> Scientific programmer, ILPS
> University of Amsterdam
> ___
> cython-devel mailing list
> cython-devel@python.org
> http://mail.python.org/mailman/listinfo/cython-devel
>
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] BUG: Cython's dies with AttributeError

2011-07-19 Thread Lars Buitinck
2011/7/19 Robert Bradshaw :
> On Thu, Jul 7, 2011 at 2:25 PM, Lars Buitinck  wrote:
>> foo.pyx:1:9: Compiler crash in PostParse
>
> I'm unable to reproduce this error, perhaps there's something missing
> in the example here?

I just pulled from your repo and I'm not getting the error message
anymore. Thanks anyway!

-- 
Lars Buitinck
Scientific programmer, ILPS
University of Amsterdam
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] How to define C-consts in python module scope

2011-07-19 Thread Lisandro Dalcin
On 19 July 2011 02:24, Vitja Makarov  wrote:
> 2011/7/18 Robert Bradshaw :
>> Trevor King and I discussed this quite a while back, but every time I
>> got around to looking at his code (I don't think he ever created a
>> formal pull request) something came up. The idea was that we could
>> support cpdef structs and extern functions as well.
>>
>
> That's interesting, I think I shouldn't hurry with my pull request.
>
> 2011/7/19 Robert Bradshaw :
>> On Mon, Jul 18, 2011 at 4:34 PM, Greg Ewing  
>> wrote:
>>> My suggestion is
>>>
>>>  cdef exposed enum:
>>>    ...
>>
>> I agree, public is an overloaded word. This meaning is analogous to
>> its use for cdef class members. Perhaps we should use "api" for api
>> generation, and public used for Python-level access, with cpdef being
>> the preferred form for declaring Python-accessible types.
>>
>
> It seems to me that cpdef is more cythonic but exposed could be used
> in this case:
>
> cdef extern from "ev.h":
>    exposed enum:
>        EV_READ
>        EV_WRITE
>

And what about this?

cdef extern from "ev.h":
   cpdef enum:
   EV_READ
   EV_WRITE


BTW, how is this supposed to work with *.pxd files? I think the values
will be exposed just in the matching implementation .pyx file, and not
with cimport, right?

-- 
Lisandro Dalcin
---
CIMEC (INTEC/CONICET-UNL)
Predio CONICET-Santa Fe
Colectora RN 168 Km 472, Paraje El Pozo
3000 Santa Fe, Argentina
Tel: +54-342-4511594 (ext 1011)
Tel/Fax: +54-342-4511169
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] How to define C-consts in python module scope

2011-07-19 Thread Vitja Makarov
2011/7/20 Lisandro Dalcin :
> On 19 July 2011 02:24, Vitja Makarov  wrote:
>> 2011/7/18 Robert Bradshaw :
>>> Trevor King and I discussed this quite a while back, but every time I
>>> got around to looking at his code (I don't think he ever created a
>>> formal pull request) something came up. The idea was that we could
>>> support cpdef structs and extern functions as well.
>>>
>>
>> That's interesting, I think I shouldn't hurry with my pull request.
>>
>> 2011/7/19 Robert Bradshaw :
>>> On Mon, Jul 18, 2011 at 4:34 PM, Greg Ewing  
>>> wrote:
 My suggestion is

  cdef exposed enum:
    ...
>>>
>>> I agree, public is an overloaded word. This meaning is analogous to
>>> its use for cdef class members. Perhaps we should use "api" for api
>>> generation, and public used for Python-level access, with cpdef being
>>> the preferred form for declaring Python-accessible types.
>>>
>>
>> It seems to me that cpdef is more cythonic but exposed could be used
>> in this case:
>>
>> cdef extern from "ev.h":
>>    exposed enum:
>>        EV_READ
>>        EV_WRITE
>>
>
> And what about this?
>
> cdef extern from "ev.h":
>   cpdef enum:
>       EV_READ
>       EV_WRITE
>

I'm fine with that, but cpdef seems to be a little bit confusing here.
On the other hand "cdef enum" is already supported inside "cdef extern" block.

I have implemented "cpdef enum" inside "cdef extern" block here:
https://github.com/vitek/cython/commit/471c41a7b37728b1b8844ea13d64b892530f403d

I'm afraid that this change could introduce some side effects, however
it still passes all the tests

>
> BTW, how is this supposed to work with *.pxd files? I think the values
> will be exposed just in the matching implementation .pyx file, and not
> with cimport, right?
>

I thought about that too and I think it's correct behaviour. By the
way it's already working as expected.


-- 
vitja.
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] How to define C-consts in python module scope

2011-07-19 Thread Robert Bradshaw
On Tue, Jul 19, 2011 at 3:02 PM, Lisandro Dalcin  wrote:
> On 19 July 2011 02:24, Vitja Makarov  wrote:
>> 2011/7/18 Robert Bradshaw :
>>> Trevor King and I discussed this quite a while back, but every time I
>>> got around to looking at his code (I don't think he ever created a
>>> formal pull request) something came up. The idea was that we could
>>> support cpdef structs and extern functions as well.
>>>
>>
>> That's interesting, I think I shouldn't hurry with my pull request.
>>
>> 2011/7/19 Robert Bradshaw :
>>> On Mon, Jul 18, 2011 at 4:34 PM, Greg Ewing  
>>> wrote:
 My suggestion is

  cdef exposed enum:
    ...
>>>
>>> I agree, public is an overloaded word. This meaning is analogous to
>>> its use for cdef class members. Perhaps we should use "api" for api
>>> generation, and public used for Python-level access, with cpdef being
>>> the preferred form for declaring Python-accessible types.
>>>
>>
>> It seems to me that cpdef is more cythonic but exposed could be used
>> in this case:
>>
>> cdef extern from "ev.h":
>>    exposed enum:
>>        EV_READ
>>        EV_WRITE
>>
>
> And what about this?
>
> cdef extern from "ev.h":
>   cpdef enum:
>       EV_READ
>       EV_WRITE

Yep, exactly.

> BTW, how is this supposed to work with *.pxd files? I think the values
> will be exposed just in the matching implementation .pyx file, and not
> with cimport, right?

It would be an error unless there's an corresponding .pyx file (which
could be empty). The idea is that one could also define extern cpdef
functions and structs and wrappers would be provided.

- Robert
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


[Cython] Cython 0.15 release

2011-07-19 Thread Robert Bradshaw
We're long overdue for a release, and this week would be a good one
for me to push one out. Hudson
https://sage.math.washington.edu:8091/hudson is looking in pretty good
shape, and though I know we've got a big pile of stuff currently in
progress, we've also got a big backlog of stuff to get out. I'd like
to finish looking at https://github.com/cython/cython/pull/38 , are
there any other changes that people want to urgently get in? Also,
I've started http://wiki.cython.org/ReleaseNotes-0.15 , feel free to
edit if you think anything should be highlighted.

- Robert
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] Cython 0.15 release

2011-07-19 Thread Dan Stromberg
Isn't this the first release that supports yield?  That's a rather big deal
to me.

On Tue, Jul 19, 2011 at 5:32 PM, Robert Bradshaw <
rober...@math.washington.edu> wrote:

> We're long overdue for a release, and this week would be a good one
> for me to push one out. Hudson
> https://sage.math.washington.edu:8091/hudson is looking in pretty good
> shape, and though I know we've got a big pile of stuff currently in
> progress, we've also got a big backlog of stuff to get out. I'd like
> to finish looking at https://github.com/cython/cython/pull/38 , are
> there any other changes that people want to urgently get in? Also,
> I've started http://wiki.cython.org/ReleaseNotes-0.15 , feel free to
> edit if you think anything should be highlighted.
>
> - Robert
> ___
> cython-devel mailing list
> cython-devel@python.org
> http://mail.python.org/mailman/listinfo/cython-devel
>
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel