]> granicus.if.org Git - python/commitdiff
Issue 4998: Decimal should not subclass or register with numbers.Real.
authorRaymond Hettinger <python@rcn.com>
Tue, 20 Jan 2009 07:24:44 +0000 (07:24 +0000)
committerRaymond Hettinger <python@rcn.com>
Tue, 20 Jan 2009 07:24:44 +0000 (07:24 +0000)
Lib/decimal.py
Lib/distutils/command/wininst-8.0.exe

index b486d36f9ac5505007f7ffbcb57536a6030299a1..26bc8efef0e9fe2e42f9c7c2481f3fe7b6775543 100644 (file)
@@ -134,7 +134,6 @@ __all__ = [
     'setcontext', 'getcontext', 'localcontext'
 ]
 
-import numbers as _numbers
 import copy as _copy
 import math as _math
 
@@ -501,7 +500,11 @@ def localcontext(ctx=None):
 
 ##### 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 @@ class Decimal(_numbers.Real):
         >>> 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
index 7403bfabf5cc10c13ef2b6a2ea276b4f6d26ff37..7407032d4b12d53cb4dd8f63b8f600e95eb8f1a8 100644 (file)
Binary files a/Lib/distutils/command/wininst-8.0.exe and b/Lib/distutils/command/wininst-8.0.exe differ