Hi Mike,

On Sat, 19 Nov 2011, Michael McCandless wrote:

If I run this:

   import lucene
   import types

   arr = lucene.JArray(types.IntType)([1, 2, 3, 4])

it makes a length 4 int array, initialized with 1, 2, 3, 4.

But then if I try to slice this array like this:

   print arr[0:]

it prints:

   [1, 2, 3]

but I think it should print:

   [1, 2, 3, 4]

ie, it's losing the last element.

If instead I slice with an explicit end index (arr[0:4]), it works correctly...

Any ideas?

You hit a bug.

I still had left some ints around where Python expects a Py_ssize_t
and the INT_MAX parameter passed when the end of the slice is omitted turned into -1, thus turning arr[0:] into arr[0:-1] on 64-bit systems. Not good.

Thank you very much for reporting this !

Fixed in rev 1204095.

Andi..

Reply via email to