On Fri, Feb 25, 2011 at 8:07 AM, Jason Grout <jason-s...@creativetrax.com> wrote: > On 2/24/11 11:35 PM, Robert Bradshaw wrote: >> >> On Thu, Feb 24, 2011 at 8:52 PM, Robert Miller<rlmills...@gmail.com> >> 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: >>> >>> SystemError: error return without exception set >>> >>> I've looked around online, and found a lot of posts about this issue >>> for specific C packages, where someone is trying to use the C API to >>> wrap some C package in Python. But none of the solutions I found >>> seemed relevant. I also looked in the Cython documentation, but it >>> doesn't have quite enough information to help. (Please prove me wrong >>> by posting a link!) >>> >>> When the code is run, it doesn't seem to go down a path which actually >>> uses stderr, but it does successfully use stdout to report its result, >>> before raising the error. It does make it all the way to the "return >>> 0;" line, but doesn't seem to actually return to the Cython function >>> I'm calling it from. Also, I can't use try/except to catch the >>> SystemError. >> >> This usually means you're returning NULL for an object, or perhaps an >> error code for a special method (without setting an error). Perhaps >> some code would be helpful? > > Note that Robert M. said it made it down to a "return 0" line. So if Cython > is expecting a pointer back, but the program does "return 0", then that > would be equivalent to returning the NULL pointer, right?
Yes, but NULL is only the error indicator for an object return type, in which case 0 would be converted to a Python int. Is the function in question declared as "except 0"? - Robert -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org