[Python-bugs-list] 1.6a1 regression in string.atol (PR#279)
M.-A. Lemburg
mal@lemburg.com
Fri, 07 Apr 2000 10:49:59 +0200
tim_one@email.msn.com wrote:
>
> Full_Name: Tim Peters
> Version: 1.6a1
> OS: Win95
> Submission from: 1cust99.tnt4.bos1.da.uu.net (63.21.45.99)
>
> Here's 1.5.2:
>
> D:\Python>python
> Python 1.5.42 (#0, Jan 31 2000, 14:05:14) [MSC 32 bit (Intel)] on win32
> Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
> >>> import string
> >>> string.atol("45.67", 10)
> Traceback (innermost last):
> File "<stdin>", line 1, in ?
> ValueError: invalid literal for atol(): 45.67
> >>>
>
> Here's 1.6a1:
>
> D:\Python>\python-1.6\python
> Python 1.6a1 (#0, Mar 30 2000, 16:30:28) [MSC 32 bit (Intel)] on win32
> Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
> >>> import string
> >>> string.atol("45.67", 10)
> 45L
> >>>
>
> 1.5.2 behavior is correct. "int" and "long" are OK here in both. string.atoi
> and string.atol are OK here in both too *provided* that an explicit base
> argument isn't given. string.atoi is OK regardless. So the regression appears
> specific to string.atol with an explicit base argument.
Do you have the latest CVS version installed ? I get
the following results:
>>> string.atol('45.67')
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "./Lib/string.py", line 230, in atol
return _long(s, base)
ValueError: invalid literal for long(): 45.67
>>> string.atol('45.67',10)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "./Lib/string.py", line 230, in atol
return _long(s, base)
ValueError: invalid literal for long(): 45.67
>>> long('45.67')
Traceback (most recent call last):
File "<stdin>", line 1, in ?
ValueError: invalid literal for long(): 45.67
>>> long('45.67',10)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
ValueError: invalid literal for long(): 45.67
--
Marc-Andre Lemburg
______________________________________________________________________
Business: http://www.lemburg.com/
Python Pages: http://www.lemburg.com/python/