[Python-Dev] [2.3a2+] Change in int() behavior

David Abrahams dave@boost-consulting.com
Fri, 07 Mar 2003 21:04:42 -0500


The following change in behavior is causing one of my tests to fail.
Is it intentional?  Should isinstance(int(x),int) really ever return
False?


$ python
Python 2.2.2 (#1, Feb  3 2003, 14:10:37)
[GCC 3.2 20020927 (prerelease)] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> int(sys.maxint * 2)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
OverflowError: long int too large to convert to int
>>> exit
'Use Ctrl-D (i.e. EOF) to exit.'
>>>

dave@penguin ~
$ /usr/local/pydebug/bin/python
Python 2.3a2+ (#1, Feb 24 2003, 15:02:10)
[GCC 3.2 20020927 (prerelease)] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
[17514 refs]
>>> int(sys.maxint * 2)
4294967294L
[17613 refs]
>>>
-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com