[issue5377] Strange behavior when performing int on a Decimal made from -sys.maxint-1

Mark Dickinson report at bugs.python.org
Fri Feb 27 12:38:29 CET 2009


Mark Dickinson <dickinsm at gmail.com> added the comment:

Why do you care whether the result is an int or a long in this case? 
Does it affect any code that you know of in a meaningful way?

> And why the difference in this behavior between 2.5.1 and 2.5.2.

There were some fairly major changes (many bugfixes, new functions to
comply with an updated specification, for example, pow, log and log10)
to the decimal module between 2.5 and 2.6, and the majority of those
changes were also backported to 2.5.2.  This particular change was part
of a set of changes that changed the internal representation of the
coefficient of a Decimal instance from a tuple to a string, for speed
reasons.  See r59144.

As Victor says, this is trivial to fix;  I'm not convinced that it's
actually worth fixing, though.  In Python 2.5, the difference between
ints and longs should be almost invisible anyway.  It's nice (for
performance reasons) if small integers are represented as ints rather
than longs.  Since this one's only just a small integer, it's difficult
to care much.  :-)

----------
components: +Library (Lib) -Interpreter Core
nosy: +marketdickinson, rhettinger
versions: +Python 2.7 -Python 2.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5377>
_______________________________________


More information about the Python-bugs-list mailing list