[Pyrex] Bug in PySequence indexing
Robert Bradshaw
robertwb at math.washington.edu
Fri May 30 02:01:20 CEST 2008
On May 29, 2008, at 3:51 PM, Greg Ewing wrote:
> Robert Bradshaw wrote:
>
>> print sizeof(Py_ssize_t), "==", sizeof(unsigned long)
>> D = { -1: "negative", <unsigned long>-1: "positive" }
>> print D[<unsigned long>-1]
>
> I don't see how that has anything to do with integer
> indexing. You've already mangled your -1 by casting it
> to an unsigned long in the first place.
Casting the -1 was just for convenience to get something big enough.
To rephrase the problem
cdef unsigned long n = 4000000000 # who cares where this number
comes from, it's probably not be a constant in the source.
D = { n: "positive" }
print D[n]
Raises a KeyError.
- Robert
More information about the Pyrex
mailing list