[Python-checkins] r68799 - in python/branches/py3k/Lib: decimal.py distutils/command/wininst-8.0.exe
raymond.hettinger
python-checkins at python.org
Tue Jan 20 08:24:44 CET 2009
Author: raymond.hettinger
Date: Tue Jan 20 08:24:44 2009
New Revision: 68799
Log:
Issue 4998: Decimal should not subclass or register with numbers.Real.
Modified:
python/branches/py3k/Lib/decimal.py
python/branches/py3k/Lib/distutils/command/wininst-8.0.exe
Modified: python/branches/py3k/Lib/decimal.py
==============================================================================
--- python/branches/py3k/Lib/decimal.py (original)
+++ python/branches/py3k/Lib/decimal.py Tue Jan 20 08:24:44 2009
@@ -134,7 +134,6 @@
'setcontext', 'getcontext', 'localcontext'
]
-import numbers as _numbers
import copy as _copy
import math as _math
@@ -501,7 +500,11 @@
##### Decimal class #######################################################
-class Decimal(_numbers.Real):
+# Do not subclass Decimal from numbers.Real and do not register it as such
+# (because Decimals are not interoperable with floats). See the notes in
+# numbers.py for more detail.
+
+class Decimal(object):
"""Floating point class for decimal arithmetic."""
__slots__ = ('_exp','_int','_sign', '_is_special')
@@ -1757,14 +1760,10 @@
>>> round(Decimal('Inf'))
Traceback (most recent call last):
...
- ...
- ...
OverflowError: cannot round an infinity
>>> round(Decimal('NaN'))
Traceback (most recent call last):
...
- ...
- ...
ValueError: cannot round a NaN
If a second argument n is supplied, self is rounded to n
Modified: python/branches/py3k/Lib/distutils/command/wininst-8.0.exe
==============================================================================
Binary files. No diff available.
More information about the Python-checkins
mailing list