Issue1781556

classification
Title: Support list.extend(iterator), and other sequence fixes
Type: Severity: normal
Components: None Versions:
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: pjenvey
Priority: normal Keywords: patch

Created on 2007-08-25.01:20:27 by pjenvey, last changed 2007-08-31.05:40:20 by pjenvey.

Files
File name Uploaded Description Edit Remove
seq_fixes-r3454.diff pjenvey, 2007-08-25.01:20:28 patch against trunk r3454
test_types_modify_sort-r3455.diff pjenvey, 2007-08-30.01:41:23 re-enable sort test in test_types, against trunk r3455
Messages
msg2823 (view) Author: Philip Jenvey (pjenvey) Date: 2007-08-25.01:20:27
Mainly this patch adds support for iterators to list.extend. This (in particular generators) is needed for setuptools

PyList's setslice was also refactored into a few methods, as it was getting large

I've imported test_list from Python 2.4.4 (and its required list_tests.py and seq_tests.py), and noticed a number of small bugs that are also fixed in this patch:

o raise an exception when a list was modified during sort()
o handle list modifications during iteration breaking list.index (port of
CPython patch #1005778)
o clear list during __new__ to match CPython
o fix list/tuple repeat with an arg < 1
o fix TypeError vs ValueError during sequence slice operations

The test_list in this patch now passes after commenting out a few tests in list_tests.py, some jython bugs, some not. The comments:

# XXX: Need Slice bounds checking (equiv to CPython's PySlice_GetIndicesEx)
# XXX: no decimal module in 2.3
# XXX: pending long/int integration of builtin's method args
# XXX: there are currently some slice bugs in Jython
# XXX: CPython specific, PyList doesn't len() during init
msg2824 (view) Author: Philip Jenvey (pjenvey) Date: 2007-08-30.01:41:23
the detection of the list being modifying during the sort is simpler than CPython's, but probably worth including as it covers many cases of this

if it's included, we could log a bug for a more involved detection routine

the test for it in test_types can also be uncommented (patch attached). This same test is included in 2.4's list_tests (included in the first patch) anyway
File Added: test_types_modify_sort-r3455.diff
msg2825 (view) Author: Philip Jenvey (pjenvey) Date: 2007-08-31.05:40:20
applied in r3460, minus the list modification detection. Logged that issue as #1785366
History
Date User Action Args
2007-08-25 01:20:27pjenveycreate