msg106554 - (view) |
Author: C Moss (cmoss60) |
Date: 2010-05-26 17:44 |
The expression int("0",0) throws an exception, though the expectation would be to return 0 (zero). int("0x0",0) == 0 int("00",0) = 0 |
|
|
msg106556 - (view) |
Author: Mark Dickinson (mark.dickinson) *  |
Date: 2010-05-26 17:56 |
Hmm. It works for me: Python 2.6.5 (r265:79063, May 18 2010, 17:12:15) [GCC 4.2.1 (Apple Inc. build 5659)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> int("0", 0) 0 What version of Python are you using, and on what platform. Also, please could you show the exact code you used and the full exception traceback? |
|
|
msg106558 - (view) |
Author: Brian Curtin (brian.curtin) *  |
Date: 2010-05-26 18:02 |
Works fine on 2.6 and 3.1 on Windows. |
|
|
msg106559 - (view) |
Author: C Moss (cmoss60) |
Date: 2010-05-26 18:03 |
I'm using MS IronPython 2.6 which is using CPython 2.6.1. Regards, Clark |
|
|
msg106560 - (view) |
Author: Ezio Melotti (ezio.melotti) *  |
Date: 2010-05-26 18:05 |
FWIW it works fine on 2.6/2.7/3.1/3.2 on Linux too. |
|
|
msg106561 - (view) |
Author: Brian Curtin (brian.curtin) *  |
Date: 2010-05-26 18:07 |
That's an IronPython bug, and I see the same thing as you when I run on IP 2.6. You could submit a bug report to them here: http://ironpython.codeplex.com/workitem/list/basic |
|
|
msg106563 - (view) |
Author: Raymond Hettinger (rhettinger) *  |
Date: 2010-05-26 18:09 |
We ought to add a test case for this so that other implementations can detect an error. |
|
|
msg106568 - (view) |
Author: Mark Dickinson (mark.dickinson) *  |
Date: 2010-05-26 19:11 |
Added some test cases in r81551 (trunk) and r81552 (release26-maint). I'll merge these to py3k. But I notice that the rules for py3k are a little odd: >>> int('0000', 0) 0 >>> int('0001', 0) Traceback (most recent call last): File "", line 1, in ValueError: invalid literal for int() with base 0: '0001' I expected the prohibition on leading zeros to apply to the first example, as well as the second. |
|
|
msg106569 - (view) |
Author: Mark Dickinson (mark.dickinson) *  |
Date: 2010-05-26 19:19 |
Tests merged to 3.x in r81553, r81554. Closing. |
|
|
msg106629 - (view) |
Author: Dino Viehland (dino.viehland) *  |
Date: 2010-05-27 23:56 |
I've opened a bug in the IronPython bug tracker: http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=27209 |
|
|
msg106639 - (view) |
Author: Mark Dickinson (mark.dickinson) *  |
Date: 2010-05-28 07:17 |
Dino: I think Clark already did this: http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=27186 Sorry; I checked that there was an IronPython issue open before I closed this one, but forgot to mention it here. |
|
|