From: Ken W. <re...@bu...> - 2010-01-14 19:05:09
|
New submission from Ken Watford <kwa...@gm...>: >>> from jarray import array >>> from java.lang import Object >>> x = array([0,1,2], Object) >>> x.append(3) >>> x array(java.lang.Object, [0, 1, 2, 3]) >>> y = array([x], Object) >>> y array(java.lang.Object, [array(java.lang.Object, [0, 1, 2, 3, None, None, None])]) >>> x == y[0] False The append on x causes some extra array space to be allocated, but apparently the end of the array isn't remembered when assigned into y. However, if we use PyObject instead of Object... >>> x = array([0,1,2], object) >>> x.append(3) >>> x array(org.python.core.PyObject, [0, 1, 2, 3]) >>> y = array([x], object) >>> y array(org.python.core.PyObject, [array(org.python.core.PyObject, [0, 1, 2, 3])]) >>> x == y[0] True In case it matters: $ java -version java version "1.6.0_14" Java(TM) SE Runtime Environment (build 1.6.0_14-b08) Java HotSpot(TM) 64-Bit Server VM (build 14.0-b16, mixed mode) ---------- components: Core messages: 5438 nosy: kwatford severity: normal status: open title: PyArray fails to clean up pre-allocated space type: behaviour versions: 2.5.1 _______________________________________ Jython tracker <re...@bu...> <http://bugs.jython.org/issue1543> _______________________________________ |