Issue1397

classification
Title: Bugs in PyList and PyJavaType.ListIndexDelegate slice setting
Type: Severity: normal
Components: Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: zyasoft Nosy List: MrMeanie, fwierzbicki, zyasoft
Priority: Keywords: patch

Created on 2009-07-05.14:45:53 by MrMeanie, last changed 2010-09-09.05:43:28 by zyasoft.

Files
File name Uploaded Description Edit Remove
Jython_r6507_PyList_and_ListIndexDelegate_slice_setting_patch_20090705_v1.patch MrMeanie, 2009-07-05.14:45:50 Patch to trunk (rev 6507)
Jython_r7114_Issue1397_list_accessor_20100908.patch MrMeanie, 2010-09-08.20:40:20 Patch to trunk (rev 7114)
Messages
msg4883 (view) Author: Geoffrey French (MrMeanie) Date: 2009-07-05.14:45:50
Please find attached a patch that fixes the issues relating to this bug
report.


Here is a description of the issues and fixes:


PyList.setSlice():
Invokes one of setslicePyList(), setsliceIterator(), or setsliceList()
to do the actual work, depending on the type of the source list.
setSliceList() was never invoked, due to:

} else if (vlaue != null && !(value instanceof List)) {
	setsliceIterator(start, stop, step, value.asIterable().iterator());
} else {
	// convert to list and invoke setsliceList()
}

The first test will fail on wrapped java.util.List objects, since they
will be of type PyObjectDerived, which does not implement java.util.List.


This if-else block has been modified so that setsliceList() will be used.



PyList.setsliceList():
This method does not work where the source list does not have the same
length as the destination slice; it fails with an index out of bounds
error. The implementation was replaced by copying setslicePyList(), and
modifying it slightly.



PyJavaType.ListIndexDelegate.setSlice():
This method does not work where the source list does not have the same
length as the destination slice; it fails with an index out of bounds
error. It used effectively the same code as PyList.setsliceList() did.
The implementation has been replaced by duplicating the
setslicePyList/setsliceIterator/setsliceList functionality of PyList.



Lib/test/test_java_list_delegate.py:
- Sizes of lists and ranges tested has been reduced. This should speed
this test up without comprimising its correctness.
- All slice tests now test None as a parameter when constructing the
slices, they didn't before; this resulted in some gaps in the testing.
- method test_set_slice_from_input_types() added to test the operation
of the modifications to the PyList slice setting methods



This patch has been tested with the regression test suite.
msg4972 (view) Author: Geoffrey French (MrMeanie) Date: 2009-07-31.18:08:25
The PyList.list member has recently been made private.
As a result, the PyJavaType.setslicePyList method can no longer access
it. This is rectified by replacing 'value.list' in this method with
'value.getList()'.
msg6052 (view) Author: Geoffrey French (MrMeanie) Date: 2010-09-08.20:40:20
Please find attached a revised version of this patch, which is up to date to r7114. The value.list -> value.getList() modification is in place.
'regrtests' passes.

Thanks.

MrMeanie
msg6054 (view) Author: Jim Baker (zyasoft) Date: 2010-09-09.05:43:27
Fixed in r7115
History
Date User Action Args
2010-09-09 05:43:28zyasoftsetstatus: open -> closed
resolution: fixed
messages: + msg6054
2010-09-08 20:40:22MrMeaniesetfiles: + Jython_r7114_Issue1397_list_accessor_20100908.patch
messages: + msg6052
2010-02-05 20:12:17fwierzbickisetnosy: + fwierzbicki
2009-07-31 18:08:25MrMeaniesetmessages: + msg4972
2009-07-08 00:52:31pjenveysetassignee: zyasoft
nosy: + zyasoft
2009-07-05 14:45:53MrMeaniecreate