On Feb 26, 2009, at 5:05 PM, Lisandro Dalcin wrote:

> On Thu, Feb 26, 2009 at 9:21 PM, Robert Bradshaw
> <[email protected]> wrote:
>> It mostly looks good to me. To summarize, you basically made a macro
>> that's the function for converting to/from the various types, and
>> applied that everywhere, right?
>
> Yes, though this is preliminary...
>
> Perhaps I should make Cython emit the code directly?

I think that's what was there originally. I'm OK with it either way.

> Moreover, I need to review the Py_ssize_t/size_t converters..

For Py_ssize_t we should be using PyNumber_Index--probably should use  
the same for size_t.

> However, I would like to point a gotcha... The some converters use
> PyNumber_{Int|Long} ... This is good as they would exercise general
> Python types implementing the special methods "__int__()" or
> "__long__()" ... However, they will also accept strings, and even
> (char) buffer objects !!!! What to do here ?? This makes me feel a bit
> uncomfortable, seems too much ...

I'm confused, I don't think PyNumber_(Int|Long) accept strings, etc.  
They only accept objects that have implemented the __int__ method.  
Note that I wrote an inline function to extract it directly if it's a  
Python int (as this is an extremely common case).

>> In your tests, "1..." could catch 100 or anything like that, so I'm
>> not sure if that's a concern.
>>
>
> Yes, know.. that was a quick hack for making the tests pass on Py2/Py3
> (because of the "L" suffix on Py2's "long" instances)... I just forgot
> to use "print" ....

Yeah, that's what I figured.

- Robert


_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to