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: Possible fix to #1334662 (int() wrong answers)
Type: Stage:
Components: Interpreter Core Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, ivilata, titty
Priority: normal Keywords: patch

Created on 2006-03-31 19:23 by ivilata, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
1334662-mystrtoul.c.diff ivilata, 2006-03-31 19:29 Fix for int('704he7g4', 18)==0 and family
1334662-test_builtin.py.diff ivilata, 2006-03-31 20:12
Messages (6)
msg49908 - (view) Author: Ivan Vilata i Balaguer (ivilata) Date: 2006-03-31 19:23
This is the patch I talked about in #1334662.  I think
it fixes int() returning zero for non-zero literals
under some bases.
msg49909 - (view) Author: Ivan Vilata i Balaguer (ivilata) Date: 2006-03-31 19:29
Logged In: YES 
user_id=1064183

I *love* this web interface...  Here you have the patch.
msg49910 - (view) Author: Ivan Vilata i Balaguer (ivilata) Date: 2006-03-31 20:12
Logged In: YES 
user_id=1064183

This is a little modification to ``test_builtin.py`` to
check for the bug.  It would be nice for someone to run it
under a 64-bit platform!
msg49911 - (view) Author: Ralf Schmitt (titty) Date: 2006-03-31 20:51
Logged In: YES 
user_id=17929

with patch to tests applied I get:

===============================================
=======================
FAIL: test_int (__main__.BuiltinTest)
-----------------------------------------------------------------
-----
Traceback (most recent call last):
  File "Lib/test/test_builtin.py", line 685, in test_int
    self.assertEqual(int('c9c336o0mlb7eg', 25), max_uint64)
AssertionError: 0 != 18446744073709551616L

-----------------------------------------------------------------
-----
Ran 60 tests in 0.118s

FAILED (failures=1)
Traceback (most recent call last):
  File "Lib/test/test_builtin.py", line 103, in <module>
    class BuiltinTest(unittest.TestCase):
  File "Lib/test/test_builtin.py", line 1587, in test_main
    run_unittest(*test_classes)
  File "/home/ralf/python-trunk/Lib/test/test_support.py", line 300, in 
run_unittest
    run_suite(suite, testclass)
  File "/home/ralf/python-trunk/Lib/test/test_support.py", line 285, in 
run_suite
    raise TestFailed(err)
test.test_support.TestFailed: Traceback (most recent call last):
  File "Lib/test/test_builtin.py", line 685, in test_int
    self.assertEqual(int('c9c336o0mlb7eg', 25), max_uint64)
AssertionError: 0 != 18446744073709551616L
msg49912 - (view) Author: Ralf Schmitt (titty) Date: 2006-03-31 20:55
Logged In: YES 
user_id=17929

After applying the patch to mystrtoul all tests work.
tests were run on ubuntu dapper amd64
msg49913 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-05-31 17:11
Logged In: YES 
user_id=849994

Bug #1334662 has now been fixed.
History
Date User Action Args
2022-04-11 14:56:16adminsetgithub: 43132
2006-03-31 19:23:16ivilatacreate