Re: Bug in PySequence indexing
Robert Bradshaw <[email protected]> Thu, 29 May 2008 18:33:37 -0700
| Newsgroups | gmane.comp.python.pyrex |
|---|---|
| Message-ID | <[email protected]> |
On May 29, 2008, at 5:54 PM, Greg Ewing wrote:
> Robert Bradshaw wrote:
>> cdef unsigned long n = 4000000000
>> D = { n: "positive" }
>> print D[n]
>
> I'll have to think more about this. I'm not sure what the
> right solution is. Maybe only do the optimisation when the
> index is a signed int type, or have two different runtime
> functions for the signed and unsigned case.
>
> What does your implementation do in the unsigned case?
> Fall back on PyObject_GetItem?
It falls back to PyObject_GetItem whenever the sign is negative and
the type is unsigned. My get/setitem functions are inlined, so they
just take an extra parameter which causes the test to be optimized
away at C compile time for signed ints.
- Robert