[Python-bugs-list] [ python-Bugs-629989 ] int("123123123123123123") doesn't work

noreply@sourceforge.net noreply@sourceforge.net
Thu, 07 Nov 2002 14:07:41 -0800


Bugs item #629989, was opened at 2002-10-28 12:33
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=629989&group_id=5470

Category: Type/class unification
Group: Python 2.3
Status: Open
Resolution: Accepted
Priority: 5
Submitted By: Guido van Rossum (gvanrossum)
Assigned to: Walter Dörwald (doerwalter)
>Summary: int("123123123123123123") doesn't work

Initial Comment:
Now that we're trying to remove the difference between
int and long, it seems fair that int() of a very long
decimal string should return a long rather than raising
ValueError.

----------------------------------------------------------------------

>Comment By: Guido van Rossum (gvanrossum)
Date: 2002-11-07 17:07

Message:
Logged In: YES 
user_id=6380

Well, there are no docs for PyInt_FromString()... :-(

Can you grep the source for uses of it and see if there are
any places where the result is accessessed as an
PyInt_Object? (I don't expect you'll find any, but who knows.)


----------------------------------------------------------------------

Comment By: Walter Dörwald (doerwalter)
Date: 2002-11-07 13:48

Message:
Logged In: YES 
user_id=89016

The current fix for the int("...") case might be problematic, as
now PyInt_FromString() might return a long object, which
breaks the C API.

Maybe we should have a two versions of PyInt_FromString():
PyInteger_FromString() that might return int or long and
PyInt_FromString which always returns int (or raises an
overflow exception).

I'll open a separate bug report for the int(1e200) case.


----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2002-11-06 13:33

Message:
Logged In: YES 
user_id=6380

int(1e200) is a separate case. If you know how to fix it,
just add a patch here. If you want to put it off, best
create a new bug report for it.

----------------------------------------------------------------------

Comment By: Walter Dörwald (doerwalter)
Date: 2002-11-06 11:17

Message:
Logged In: YES 
user_id=89016

Checked in as:
Lib/test/test_b1.py 1.56
Objects/intobject.c 2.94
Objects/longobject.c 1.144

Should I open a seperate bug report for the int(1e200) case?

----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2002-11-06 11:00

Message:
Logged In: YES 
user_id=6380

If it works, check it in.

----------------------------------------------------------------------

Comment By: Walter Dörwald (doerwalter)
Date: 2002-11-06 09:27

Message:
Logged In: YES 
user_id=89016

How about the following patch (diff.txt): In addition to
creating longs when necessary, it fixes the problem of the
fixed 512 char unicode conversion buffer.

What should we do about int(1e200)?


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=629989&group_id=5470