[ python-Bugs-967657 ] PyInt_FromString failed with certain hex/oct

SourceForge.net noreply at sourceforge.net
Sun Jun 6 12:09:13 EDT 2004


Bugs item #967657, was opened at 2004-06-06 16:09
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=967657&group_id=5470

Category: Parser/Compiler
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Qian Wenjie (qwj)
Assigned to: Nobody/Anonymous (nobody)
Summary: PyInt_FromString failed with certain hex/oct

Initial Comment:
When numbers are 0x80000000 through 0xffffffff and 
020000000000
through 037777777777, it will translate into negative.

Example:

>>> 030000000000
-1073741824
>>> int('030000000000',0)
-1073741824


patches to Python 2.3.4:

Python/compile.c
1259c1259
<               x = (long) PyOS_strtoul(s, &end, 0);
---
>               x = (long) PyOS_strtol(s, &end, 0);

Objects/intobject.c
293c293
<               x = (long) PyOS_strtoul(s, &end, base);
---
>               x = (long) PyOS_strtol(s, &end, base);




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

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



More information about the Python-bugs-list mailing list