This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: int("- 1") is valud, but float("- 1") isn't. Which is right?
Type: Stage:
Components: Interpreter Core Versions: Python 3.0
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: facundobatista, gvanrossum, jjconti, mark.dickinson
Priority: low Keywords: easy

Created on 2008-01-10 01:00 by gvanrossum, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
bug_fix_for_1779.diff jjconti, 2008-01-19 16:55
bug_fix_for_1779-plustests.diff jjconti, 2008-01-19 18:46
Messages (7)
msg59641 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2008-01-10 01:00
I discovered that when converting a string to an int or float, the int
conversion allows whitespace after the sign, while the float conversion
doesn't. I think they should be consistent.
msg59691 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2008-01-11 01:56
Moreover I think float is right and int is wrong.

Something to fix in 3.0, probably not in 2.6 (don't want to break too
much stuff that worked in 2.5).
msg59831 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2008-01-12 17:35
For Python 3.0, this is a trivial fix:  two lines need to be removed 
from PyLong_FromString in longobject.c, and then the tests in 
test_builtin need to be fixed up.

(For Python 2.6, the fix would be a bit more involved:  PyOS_strtol 
would also need fixing.)

A good candidate for the bug day?
msg60181 - (view) Author: Facundo Batista (facundobatista) * (Python committer) Date: 2008-01-19 15:10
Only left the version 3.0, as the OP said it's not so important as to
break possible previous working code.
msg60195 - (view) Author: Juan José Conti (jjconti) * Date: 2008-01-19 16:55
This is my first patch. 

Bug fix on revision 60076.
msg60209 - (view) Author: Juan José Conti (jjconti) * Date: 2008-01-19 18:45
The same patch as before plus tests.
msg60215 - (view) Author: Facundo Batista (facundobatista) * (Python committer) Date: 2008-01-19 19:13
Fixed in r60090.

Thanks Juanjo for your contribution!

Please sign and send in a contributor form whenever you have time; the
forms are at http://www.python.org/psf/contrib/ .
History
Date User Action Args
2022-04-11 14:56:29adminsetgithub: 46112
2008-01-19 19:13:07facundobatistasetstatus: open -> closed
resolution: fixed
messages: + msg60215
2008-01-19 18:46:00jjcontisetfiles: + bug_fix_for_1779-plustests.diff
messages: + msg60209
2008-01-19 16:55:41jjcontisetfiles: + bug_fix_for_1779.diff
nosy: + jjconti
messages: + msg60195
2008-01-19 15:10:29facundobatistasetnosy: + facundobatista
messages: + msg60181
versions: - Python 2.6, Python 2.5, Python 2.4
2008-01-12 17:35:28mark.dickinsonsetkeywords: + easy
nosy: + mark.dickinson
messages: + msg59831
2008-01-11 01:56:03gvanrossumsetmessages: + msg59691
2008-01-10 01:00:02gvanrossumcreate