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.

Author debedb
Recipients debedb, theller
Date 2009-02-26.20:24:25
SpamBayes Score 0.0020234499
Marked as misclassified No
Message-id <1235679869.5.0.97489087981.issue5377@psf.upfronthosting.co.za>
In-reply-to
Content
On some Python builds (2.5.2 and 2.6.1) the following program:

import sys
from decimal import Decimal

def show(n):
    print type(n)
    d = Decimal(str(n))
    i = int(d)
    t = type(i)
    print t
    i2 = int(i)
    t2 = type(i2)
    print t2

n = - sys.maxint - 1
show(n)

prints

<type 'int'>
<type 'long'>
<type 'int'>

While on 2.4 and 2.5.1 it prints:

<type 'int'>
<type 'int'>
<type 'int'>

This seems to happen only with -sys.maxint-1 number!

This has been tested with the following builds:

*** "Strange" result (with long): ***

2.6.1 (r261:67515, Feb 26 2009, 12:21:28) [GCC 4.2.4 (Ubuntu
4.2.4-1ubuntu3)]

2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)]

2.5.2 (r252:60911, Jul 31 2008, 17:28:52) [GCC 4.2.3 (Ubuntu
4.2.3-2ubuntu7)]

2.5.2 and 2.6.1 on Windows Server 2003

*** "Expected" result (all int): ***

2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] 

2.5.1 (r251:54863, Oct 15 2007, 13:50:22) [GCC 3.4.6 20060404 (Red Hat
3.4.6-3)]

2.5.1 (r251:54863, Jul 31 2008, 23:17:40) [GCC 4.1.3 20070929
(prerelease) (Ubuntu 4.1.2-16ubuntu2)] 

2.4.5 (#2, Aug  1 2008, 02:20:59) [GCC 4.3.1] 

2.4.5 (#1, Jul 22 2008, 08:30:02) [GCC 3.4.3 (csl-sol210-3_4-20050802)]

2.4.3 (#1, Sep 21 2007, 20:05:43) [GCC 3.4.6 20060404 (Red Hat 3.4.6-8)]
History
Date User Action Args
2009-02-26 20:24:29debedbsetrecipients: + debedb, theller
2009-02-26 20:24:29debedbsetmessageid: <1235679869.5.0.97489087981.issue5377@psf.upfronthosting.co.za>
2009-02-26 20:24:27debedblinkissue5377 messages
2009-02-26 20:24:26debedbcreate