Issue1802626

classification
Title: list and tuple multiplication
Type: Severity: normal
Components: Core Versions:
Milestone:
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: rajesh_battala, thomas_meister
Priority: normal Keywords:

Created on 2007-09-26.11:13:49 by thomas_meister, last changed 2007-09-28.07:25:37 by rajesh_battala.

Messages
msg1940 (view) Author: Weatherman (thomas_meister) Date: 2007-09-26.11:13:49
Hi,

I found a bug (maybe you see it a feature) in the handling of negative values when using lists and tuples.

If I use a string, then an empty string is returned:
> "0" * (-1)
""

If I use a list or a tuple, then a runtime exception happens
> [0] * (-1)
java.lang.NegativeArraySizeException

> (0,) * (-1)
java.lang.NegativeArraySizeException

Note: CPython returns an empty list or empty tuple instead.

I found this bug/inconsistency when I tried to import decimal.py python source.

Thank you in advance,
Greetings
Weatherman
msg1941 (view) Author: rajesh battala (rajesh_battala) Date: 2007-09-28.04:39:37
hi Weatherman..
i ve  lookeda at your comment.
but looks its working fine .. try with the new build. it will work.

Jython 2.3a0 on java1.5.0
Type "copyright", "credits" or "license" for more information.
>>> "0"*(-1)
''
>>> [0]*(-1)
[]
>>> (0,)*(-1)
()
>>>
msg1942 (view) Author: Weatherman (thomas_meister) Date: 2007-09-28.07:12:59
You fixed it already, thank you.
msg1943 (view) Author: rajesh battala (rajesh_battala) Date: 2007-09-28.07:25:37
thomas_meister
you can close the bug right!
History
Date User Action Args
2007-09-26 11:13:49thomas_meistercreate