Re: [sage-devel] Re: exceptions, Python, Cython, C

2011-03-07 Thread Robert Bradshaw
That would do it :). This is why we need automatic .h -> .pxd declarations. Also, it's been thrown around a couple of times that it may be worth making "cdef foo()" a warning, forcing the user to explicitly declare "cdef object foo()" (or, in your case, "cdef int foo() :-). On Mon, Mar 7, 2011 at

[sage-devel] Re: exceptions, Python, Cython, C

2011-03-07 Thread Robert Miller
The problem: I had a C function declared as "int foo()" but was importing it in Cython as "cdef foo()". Thus when foo returned 0, Cython thought this was a NULL pointer and raised the error above. Thanks for the help, everyone. -- To post to this group, send an email to sage-devel@googlegroups.c

Re: [sage-devel] Re: exceptions, Python, Cython, C

2011-02-25 Thread Robert Bradshaw
On Fri, Feb 25, 2011 at 8:07 AM, Jason Grout wrote: > On 2/24/11 11:35 PM, Robert Bradshaw wrote: >> >> On Thu, Feb 24, 2011 at 8:52 PM, Robert Miller >>  wrote: >>> >>> I'm working on wrapping a C package in Cython for use in Sage, and I'm >>> having some trouble. I think the problem has to do wi

[sage-devel] Re: exceptions, Python, Cython, C

2011-02-25 Thread Jason Grout
On 2/24/11 11:35 PM, Robert Bradshaw wrote: On Thu, Feb 24, 2011 at 8:52 PM, Robert Miller wrote: I'm working on wrapping a C package in Cython for use in Sage, and I'm having some trouble. I think the problem has to do with the fact that the C program uses stderr to report issues. When the pro

Re: [sage-devel] Re: exceptions, Python, Cython, C

2011-02-25 Thread Robert Bradshaw
On Fri, Feb 25, 2011 at 1:07 AM, Tom Boothby wrote: > FWIW, I get that error message on the following: > > sage: cython(""" > cdef int foo(int z) except -1: >    return z > > def bar(z): >    return foo(z) > """) > sage: bar(-1) > ---

Re: [sage-devel] Re: exceptions, Python, Cython, C

2011-02-25 Thread Tom Boothby
FWIW, I get that error message on the following: sage: cython(""" cdef int foo(int z) except -1: return z def bar(z): return foo(z) """) sage: bar(-1) --- SystemError Traceback (most rece

[sage-devel] Re: exceptions, Python, Cython, C

2011-02-24 Thread Nils Bruin
On Feb 24, 8:52 pm, Robert Miller wrote: > I'm working on wrapping a C package in Cython for use in Sage, and I'm > having some trouble. I think the problem has to do with the fact that > the C program uses stderr to report issues. When the program exits, I > get the following message: > > SystemE