Re: [Cython] having a weird issue with wrapped function failing in only certain cases

2009-06-29 Thread Chris Colbert
Just to be sure... if you look at all the OpenCV headers, can you see __stdcall somewhere? here's the results of a grep: brucewa...@broo:/usr/local/include/opencv$ grep -ir __stdcall * cxtypes.h:#define CV_STDCALL __stdcall highgui.h:#define CV_STDCALL __stdcall ml.h:#define

Re: [Cython] having a weird issue with wrapped function failing in only certain cases

2009-06-29 Thread Lisandro Dalcin
Now send me the results of the cmd line below, :-) $ grep -ir CV_STDCALL * On Mon, Jun 29, 2009 at 7:08 PM, Chris Colbertsccolb...@gmail.com wrote: Just to be sure... if you look at all the OpenCV headers, can you see __stdcall somewhere? here's the results of a grep:

Re: [Cython] having a weird issue with wrapped function failing in only certain cases

2009-06-29 Thread Lisandro Dalcin
Of better, please feel free to send me a tar.gz/zip containing the full headers of OpenCV. Send them to dalc...@gmail.com ... On Mon, Jun 29, 2009 at 9:23 PM, Lisandro Dalcindalc...@gmail.com wrote: Now send me the results of the cmd line below,  :-) $ grep -ir CV_STDCALL * On Mon, Jun 29,

Re: [Cython] having a weird issue with wrapped function failing in only certain cases

2009-06-29 Thread Chris Colbert
how about both? :) brucewa...@broo:/usr/local/include/opencv$ grep -ir CV_STDCALL * cxcore.h:typedef IplImage* (CV_STDCALL* Cv_iplCreateImageHeader) cxcore.h:typedef void (CV_STDCALL* Cv_iplAllocateImageData)(IplImage*,int,int); cxcore.h:typedef void (CV_STDCALL* Cv_iplDeallocate)(IplImage*,int);

Re: [Cython] having a weird issue with wrapped function failing in only certain cases

2009-05-28 Thread Chris Colbert
Alright, I fixed the problem by hacking the Cython generated C file. I removed everything in the IF clause that determined whether the Python Arguments were keyword argument or not and left only the PyTuple_GET_ITEM statements. I then changed the PyMethodDef line like so: old entry:

Re: [Cython] having a weird issue with wrapped function failing in only certain cases

2009-05-28 Thread Robert Bradshaw
On May 28, 2009, at 9:16 AM, Chris Colbert wrote: Alright, I fixed the problem by hacking the Cython generated C file. I removed everything in the IF clause that determined whether the Python Arguments were keyword argument or not and left only the PyTuple_GET_ITEM statements. I then

Re: [Cython] having a weird issue with wrapped function failing in only certain cases

2009-05-28 Thread Chris Colbert
Robert, That's correct. Of course I had to remove all the checks related to Keyword args in the body of the function before it would execute. So essentially, cleaning the code so that it only accepts positional arguments fixes the crashing problem. Chris On Thu, May 28, 2009 at 6:40 PM, Robert

Re: [Cython] having a weird issue with wrapped function failing in only certain cases

2009-05-28 Thread Chris Colbert
Just to clarify, I've never used keyword arguments with this function. Chris On Thu, May 28, 2009 at 10:46 PM, Chris Colbert sccolb...@gmail.com wrote: Robert, That's correct. Of course I had to remove all the checks related to Keyword args in the body of the function before it would execute.

Re: [Cython] having a weird issue with wrapped function failing in only certain cases

2009-05-27 Thread Lisandro Dalcin
According to the docs, http://opencv.willowgarage.com/wiki/CvReference#Sampling.2CInterpolationandGeometricalTransforms, There are 4 possible values (you mention 5). Is that OpenCV documentation dated? IMHO, you should use them. To expose these constants in Cython code (likely in some pxd), you

Re: [Cython] having a weird issue with wrapped function failing in only certain cases

2009-05-27 Thread Lisandro Dalcin
On Wed, May 27, 2009 at 11:36 AM, Chris Colbert sccolb...@gmail.com wrote: sometimes the docs are a bit dated. But nonetheless, those constants are just integers defines in the header files and is where I got the values 0-4, I used the integers in the example just to make it a bit more clear.

Re: [Cython] having a weird issue with wrapped function failing in only certain cases

2009-05-27 Thread Chris Colbert
I've never used valgrind before. Any pointers? I went back to the Cython generated C source and explicitly included the appropriate header file and explicitly passed CV_INTER_LINEAR (defined as 1) to the C function call. Same story, it crashes. I've gone line by line now through the Cython code

Re: [Cython] having a weird issue with wrapped function failing in only certain cases

2009-05-27 Thread Lisandro Dalcin
On Wed, May 27, 2009 at 3:09 PM, Chris Colbert sccolb...@gmail.com wrote: Lisandro, Unfortunately, I'm on a windows machine and thus can't use valgrind. Wow... Well, not in a good position to help you... Anyway, Did you build OpenCV with EXACTLY the same compiler your installed Python was

Re: [Cython] having a weird issue with wrapped function failing in only certain cases

2009-05-27 Thread Chris Colbert
can't do that... Python 2.5 was built with VS 2003 which is no longer available. So i'm using minGW. I may throw Ubuntu on a partition and test there if it continues to be an issue. Thanks for your help though! Chris On Wed, May 27, 2009 at 4:48 PM, Lisandro Dalcin dalc...@gmail.com wrote:

Re: [Cython] having a weird issue with wrapped function failing in only certain cases

2009-05-27 Thread Dag Sverre Seljebotn
Chris Colbert wrote: Quick note: By linker bug I really meant a bug in your make system, not in the linker itself :-) But I guess that's how you interpreted it. Dag Sverre ___ Here is a pure cython example that

Re: [Cython] having a weird issue with wrapped function failing in only certain cases

2009-05-27 Thread Chris Colbert
Dag, I've listed the code below and added the memory cleanup to the Cython file. Behavior is the same. #---the pure C code which doesnt crash---# #include highgui.h #include cv.h #include cxcore.h #include cxtypes.h int main(void) { IplImage* img, *img2; img =

Re: [Cython] having a weird issue with wrapped function failing in only certain cases

2009-05-27 Thread Lisandro Dalcin
On Wed, May 27, 2009 at 6:39 PM, Chris Colbert sccolb...@gmail.com wrote: To me, the two C files look equivalent. Do you notice anything out of the ordinary? A final suggestion... Do you know if it is possible to force MinGW to use the same MS C runtime library your Python 2.5 is using? In

Re: [Cython] having a weird issue with wrapped function failing in only certain cases

2009-05-27 Thread Chris Colbert
I think I'm starting to narrow it down. I made the following python extension module by hand and it works. I can pass any value (0, 1, 2, or 3) to the function exttest.test() in python and they all work properly. #- exttest.c -# #include Python.h #include

Re: [Cython] having a weird issue with wrapped function failing in only certain cases

2009-05-27 Thread Chris Colbert
I should note in the last code example, I manually change the integer and the recompile. i.e. the python arguments passed to the function are irrelevant. Chris On Thu, May 28, 2009 at 1:00 AM, Chris Colbert sccolb...@gmail.com wrote: I think I'm starting to narrow it down. I made the

Re: [Cython] having a weird issue with wrapped function failing in only certain cases

2009-05-27 Thread Lisandro Dalcin
On Thu, May 28, 2009 at 2:00 AM, Chris Colbert sccolb...@gmail.com wrote: So, I think I've ruled out a compiler issue. Any pointers on where to look now? I told you... 1) When building core OpenVC, any chance you or the buildsystem is passing some special flag to MinGW? 2) Do you know if it

[Cython] having a weird issue with wrapped function failing in only certain cases

2009-05-26 Thread Chris Colbert
So I'm wrapping the OpenCV library in Cython and its coming along quite nicely (thanks to everyone here for getting me up to speed!), but today I've run across a strange issue where a wrapped function fails for certain values of integer arguments, but a pure c implementation testing the same thing