Issue1982

classification
Title: enumerate() should match CPython semantics
Type: behaviour Severity: normal
Components: Versions: Jython 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: zyasoft Nosy List: Arfrever, fwierzbicki, santa4nt, zyasoft
Priority: immediate Keywords: patch

Created on 2012-11-03.01:22:20 by Arfrever, last changed 2014-06-24.18:26:33 by zyasoft.

Files
File name Uploaded Description Edit Remove
issue1982.diff santa4nt, 2014-05-14.21:57:47
issue1982_plus.diff santa4nt, 2014-05-15.04:10:06 Additional fix to address `start` parameter > Integer.MAX_VALUE
Messages
msg7500 (view) Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) Date: 2012-11-03.01:22:16
enumerate() should support start argument.
http://docs.python.org/2.7/library/functions.html#enumerate

>>> list(enumerate("abc", 5))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: enumerate() takes at most 1 arguments (2 given)
>>>
msg8402 (view) Author: Jim Baker (zyasoft) Date: 2014-05-14.19:14:13
Blocker for beta 3
msg8403 (view) Author: Santoso Wijaya (santa4nt) Date: 2014-05-14.21:57:47
Fix and unittest fix + addition to regress.
msg8404 (view) Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) Date: 2014-05-14.23:53:17
With this fix, do any tests from lib-python/2.7/test/test_enumerate.py still fail?
msg8405 (view) Author: Santoso Wijaya (santa4nt) Date: 2014-05-15.00:44:05
Ah. Yes. Some still do. That patch just addresses the immediate problem of the missing function parameter.
msg8406 (view) Author: Santoso Wijaya (santa4nt) Date: 2014-05-15.02:01:20
Those other failures should be their own issue, no? I'm working on a patch for them now.
msg8407 (view) Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) Date: 2014-05-15.02:02:44
Yes.
msg8408 (view) Author: Santoso Wijaya (santa4nt) Date: 2014-05-15.04:10:06
In any case, I'm updating the patch to handle a case where the 'start' parameter is bigger than Integer.MAX_VALUE. Incidentally, this also passes most of previous failures (all but one) in lib-python/2.7/test/test_enumerate.py
msg8409 (view) Author: Santoso Wijaya (santa4nt) Date: 2014-05-15.04:15:30
Actually, the remaining failure from lib-python/2.7/test/test_enumerate.py is an optimization check. It has nothing to do with PyEnumerate.java implementation. 

That is, that one should be its own issue.
msg8419 (view) Author: Jim Baker (zyasoft) Date: 2014-05-16.14:04:08
Santoso, re extending enumerate's range to PyLong and possible enumerate optimization, we should just keep this bug open for this purpose, there's no need to split this issue into finer chunks.

Target beta 4 for range/optimization
msg8421 (view) Author: Santoso Wijaya (santa4nt) Date: 2014-05-16.15:28:30
OK then, issue1982_plus.diff should have everything, along with a pull request on bitbucket.
msg8627 (view) Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) Date: 2014-06-12.01:22:52
Apparently the older patch was committed in http://hg.python.org/jython/rev/4aaec46e3ee5.

Santoso Wijaya: Could you create an updated patch with remaining needed changes?
msg8629 (view) Author: Santoso Wijaya (santa4nt) Date: 2014-06-12.05:20:16
The remaining fix (making the 'start' argument accepts long integer) is in this pull request: https://bitbucket.org/jython/jython/pull-request/37/fix-enumerate-s-start-parameter-to-accept/diff
msg8684 (view) Author: Jim Baker (zyasoft) Date: 2014-06-18.22:25:47
Fixed as of http://hg.python.org/jython/rev/7516d3820146
History
Date User Action Args
2014-06-24 18:26:33zyasoftsetstatus: pending -> closed
2014-06-18 22:25:47zyasoftsetstatus: open -> pending
resolution: accepted -> fixed
messages: + msg8684
2014-06-12 05:20:16santa4ntsetmessages: + msg8629
2014-06-12 01:22:53Arfreversetmessages: + msg8627
2014-05-16 15:28:30santa4ntsetmessages: + msg8421
2014-05-16 14:04:31zyasoftsettitle: enumerate() should support start argument -> enumerate() should match CPython semantics
2014-05-16 14:04:09zyasoftsetmessages: + msg8419
2014-05-15 04:15:30santa4ntsetmessages: + msg8409
2014-05-15 04:10:08santa4ntsetfiles: + issue1982_plus.diff
messages: + msg8408
2014-05-15 02:02:44Arfreversetmessages: + msg8407
2014-05-15 02:01:21santa4ntsetmessages: + msg8406
2014-05-15 00:44:06santa4ntsetmessages: + msg8405
2014-05-14 23:53:17Arfreversetmessages: + msg8404
2014-05-14 21:57:48santa4ntsetfiles: + issue1982.diff
versions: + Jython 2.7
nosy: + santa4nt
messages: + msg8403
keywords: + patch
type: behaviour
2014-05-14 19:14:13zyasoftsetpriority: normal -> immediate
assignee: zyasoft
resolution: accepted
messages: + msg8402
nosy: + zyasoft
2013-02-26 18:36:20fwierzbickisetpriority: normal
nosy: + fwierzbicki
2012-11-03 01:22:21Arfrevercreate