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

David Abrahams dave@boost-consulting.com
Sat, 08 Mar 2003 00:27:07 -0500


Tim Peters <tim.one@comcast.net> writes:

> [David Abrahams]
>> The following change in behavior is causing one of my tests to fail.
>
> Dear Lord, another buggy test <wink>.
>
>> Is it intentional?
>
> Yes, as part of the ongoing push toward int/long unification.  If you tried
> the same test in Python 2.1, it would have blown up in the "sys.maxint * 2"
> part.  In 2.2, it blows up in the "int()" part.  In 2.3, it doesn't blow up
> at all.  In 2.4 or 2.5, __builtin__.int and __builtin__.long may well be the
> same object.

Yes, but in the meantime, PyInt_AS_LONG( invoke_int_conversion(x) )
might be a crash instead of raising an exception.  That's what is
causing my test to fail.  I guess I just need to lowercase a few
characters, but it's worth noting that this change breaks existing
extension module code.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com