Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(120483)

Side by Side Diff: Lib/decimal.py

Issue 7652: Merge C version of decimal into py3k.
Patch Set: Created 7 years, 11 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Include/longintrepr.h ('k') | Lib/test/support.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2004 Python Software Foundation. 1 # Copyright (c) 2004 Python Software Foundation.
2 # All rights reserved. 2 # All rights reserved.
3 3
4 # Written by Eric Price <eprice at tjhsst.edu> 4 # Written by Eric Price <eprice at tjhsst.edu>
5 # and Facundo Batista <facundo at taniquetil.com.ar> 5 # and Facundo Batista <facundo at taniquetil.com.ar>
6 # and Raymond Hettinger <python at rcn.com> 6 # and Raymond Hettinger <python at rcn.com>
7 # and Aahz <aahz at pobox.com> 7 # and Aahz <aahz at pobox.com>
8 # and Tim Peters 8 # and Tim Peters
9 9
10 # This module should be kept in sync with the latest updates of the 10 # This module should be kept in sync with the latest updates of the
(...skipping 28 matching lines...) Expand all
39 >>> from decimal import * 39 >>> from decimal import *
40 >>> setcontext(ExtendedContext) 40 >>> setcontext(ExtendedContext)
41 >>> Decimal(0) 41 >>> Decimal(0)
42 Decimal('0') 42 Decimal('0')
43 >>> Decimal('1') 43 >>> Decimal('1')
44 Decimal('1') 44 Decimal('1')
45 >>> Decimal('-.0123') 45 >>> Decimal('-.0123')
46 Decimal('-0.0123') 46 Decimal('-0.0123')
47 >>> Decimal(123456) 47 >>> Decimal(123456)
48 Decimal('123456') 48 Decimal('123456')
49 >>> Decimal('123.45e12345678901234567890') 49 >>> Decimal('123.45e12345678')
50 Decimal('1.2345E+12345678901234567892') 50 Decimal('1.2345E+12345680')
51 >>> Decimal('1.33') + Decimal('1.27') 51 >>> Decimal('1.33') + Decimal('1.27')
52 Decimal('2.60') 52 Decimal('2.60')
53 >>> Decimal('12.34') + Decimal('3.87') - Decimal('18.41') 53 >>> Decimal('12.34') + Decimal('3.87') - Decimal('18.41')
54 Decimal('-2.20') 54 Decimal('-2.20')
55 >>> dig = Decimal(1) 55 >>> dig = Decimal(1)
56 >>> print(dig / Decimal(3)) 56 >>> print(dig / Decimal(3))
57 0.333333333 57 0.333333333
58 >>> getcontext().prec = 18 58 >>> getcontext().prec = 18
59 >>> print(dig / Decimal(3)) 59 >>> print(dig / Decimal(3))
60 0.333333333333333333 60 0.333333333333333333
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 372
373 # List of public traps and flags 373 # List of public traps and flags
374 _signals = [Clamped, DivisionByZero, Inexact, Overflow, Rounded, 374 _signals = [Clamped, DivisionByZero, Inexact, Overflow, Rounded,
375 Underflow, InvalidOperation, Subnormal] 375 Underflow, InvalidOperation, Subnormal]
376 376
377 # Map conditions (per the spec) to signals 377 # Map conditions (per the spec) to signals
378 _condition_map = {ConversionSyntax:InvalidOperation, 378 _condition_map = {ConversionSyntax:InvalidOperation,
379 DivisionImpossible:InvalidOperation, 379 DivisionImpossible:InvalidOperation,
380 DivisionUndefined:InvalidOperation, 380 DivisionUndefined:InvalidOperation,
381 InvalidContext:InvalidOperation} 381 InvalidContext:InvalidOperation}
382
383 # Valid rounding modes
384 _rounding_modes = (ROUND_DOWN, ROUND_HALF_UP, ROUND_HALF_EVEN, ROUND_CEILING,
385 ROUND_FLOOR, ROUND_UP, ROUND_HALF_DOWN, ROUND_05UP)
382 386
383 ##### Context Functions ################################################## 387 ##### Context Functions ##################################################
384 388
385 # The getcontext() and setcontext() function manage access to a thread-local 389 # The getcontext() and setcontext() function manage access to a thread-local
386 # current context. Py2.4 offers direct support for thread locals. If that 390 # current context. Py2.4 offers direct support for thread locals. If that
387 # is not available, use threading.current_thread() which is slower but will 391 # is not available, use threading.current_thread() which is slower but will
388 # work for older Pythons. If threads are not part of the build, create a 392 # work for older Pythons. If threads are not part of the build, create a
389 # mock threading object with threading.local() returning the module namespace. 393 # mock threading object with threading.local() returning the module namespace.
390 394
391 try: 395 try:
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 >>> Decimal.from_float(float('inf')) 681 >>> Decimal.from_float(float('inf'))
678 Decimal('Infinity') 682 Decimal('Infinity')
679 >>> Decimal.from_float(-float('inf')) 683 >>> Decimal.from_float(-float('inf'))
680 Decimal('-Infinity') 684 Decimal('-Infinity')
681 >>> Decimal.from_float(-0.0) 685 >>> Decimal.from_float(-0.0)
682 Decimal('-0') 686 Decimal('-0')
683 687
684 """ 688 """
685 if isinstance(f, int): # handle integer inputs 689 if isinstance(f, int): # handle integer inputs
686 return cls(f) 690 return cls(f)
687 if _math.isinf(f) or _math.isnan(f): # raises TypeError if not a float 691 if not isinstance(f, float):
692 raise TypeError("argument must be int or float.")
693 if _math.isinf(f) or _math.isnan(f):
688 return cls(repr(f)) 694 return cls(repr(f))
689 if _math.copysign(1.0, f) == 1.0: 695 if _math.copysign(1.0, f) == 1.0:
690 sign = 0 696 sign = 0
691 else: 697 else:
692 sign = 1 698 sign = 1
693 n, d = abs(f).as_integer_ratio() 699 n, d = abs(f).as_integer_ratio()
694 k = d.bit_length() - 1 700 k = d.bit_length() - 1
695 result = _dec_from_triple(sign, str(n*5**k), -k) 701 result = _dec_from_triple(sign, str(n*5**k), -k)
696 if cls is Decimal: 702 if cls is Decimal:
697 return result 703 return result
(...skipping 1201 matching lines...) Expand 10 before | Expand all | Expand 10 after
1899 else: 1905 else:
1900 product = _dec_from_triple(self._sign ^ other._sign, 1906 product = _dec_from_triple(self._sign ^ other._sign,
1901 str(int(self._int) * int(other._int)), 1907 str(int(self._int) * int(other._int)),
1902 self._exp + other._exp) 1908 self._exp + other._exp)
1903 1909
1904 return product.__add__(third, context) 1910 return product.__add__(third, context)
1905 1911
1906 def _power_modulo(self, other, modulo, context=None): 1912 def _power_modulo(self, other, modulo, context=None):
1907 """Three argument version of __pow__""" 1913 """Three argument version of __pow__"""
1908 1914
1909 # if can't convert other and modulo to Decimal, raise 1915 other = _convert_other(other)
1910 # TypeError; there's no point returning NotImplemented (no 1916 if other is NotImplemented:
1911 # equivalent of __rpow__ for three argument pow) 1917 return other
1912 other = _convert_other(other, raiseit=True) 1918 modulo = _convert_other(modulo)
1913 modulo = _convert_other(modulo, raiseit=True) 1919 if modulo is NotImplemented:
1920 return modulo
1914 1921
1915 if context is None: 1922 if context is None:
1916 context = getcontext() 1923 context = getcontext()
1917 1924
1918 # deal with NaNs: if there are any sNaNs then first one wins, 1925 # deal with NaNs: if there are any sNaNs then first one wins,
1919 # (i.e. behaviour for NaNs is identical to that of fma) 1926 # (i.e. behaviour for NaNs is identical to that of fma)
1920 self_is_nan = self._isnan() 1927 self_is_nan = self._isnan()
1921 other_is_nan = other._isnan() 1928 other_is_nan = other._isnan()
1922 modulo_is_nan = modulo._isnan() 1929 modulo_is_nan = modulo._isnan()
1923 if self_is_nan or other_is_nan or modulo_is_nan: 1930 if self_is_nan or other_is_nan or modulo_is_nan:
(...skipping 1901 matching lines...) Expand 10 before | Expand all | Expand 10 after
3825 flags - When an exception is caused, flags[exception] is set. 3832 flags - When an exception is caused, flags[exception] is set.
3826 (Whether or not the trap_enabler is set) 3833 (Whether or not the trap_enabler is set)
3827 Should be reset by user of Decimal instance. 3834 Should be reset by user of Decimal instance.
3828 Emin - Minimum exponent 3835 Emin - Minimum exponent
3829 Emax - Maximum exponent 3836 Emax - Maximum exponent
3830 capitals - If 1, 1*10^1 is printed as 1E+1. 3837 capitals - If 1, 1*10^1 is printed as 1E+1.
3831 If 0, printed as 1e1 3838 If 0, printed as 1e1
3832 clamp - If 1, change exponents if too high (Default 0) 3839 clamp - If 1, change exponents if too high (Default 0)
3833 """ 3840 """
3834 3841
3835 def __init__(self, prec=None, rounding=None, 3842 def __init__(self, prec=None, rounding=None, Emin=None, Emax=None,
3836 traps=None, flags=None, 3843 capitals=None, clamp=None, flags=None, traps=None,
3837 Emin=None, Emax=None, 3844 _ignored_flags=None):
3838 capitals=None, clamp=None,
3839 _ignored_flags=None):
3840 # Set defaults; for everything except flags and _ignored_flags, 3845 # Set defaults; for everything except flags and _ignored_flags,
3841 # inherit from DefaultContext. 3846 # inherit from DefaultContext.
3842 try: 3847 try:
3843 dc = DefaultContext 3848 dc = DefaultContext
3844 except NameError: 3849 except NameError:
3845 pass 3850 pass
3846 3851
3847 self.prec = prec if prec is not None else dc.prec 3852 self.prec = prec if prec is not None else dc.prec
3848 self.rounding = rounding if rounding is not None else dc.rounding 3853 self.rounding = rounding if rounding is not None else dc.rounding
3849 self.Emin = Emin if Emin is not None else dc.Emin 3854 self.Emin = Emin if Emin is not None else dc.Emin
3850 self.Emax = Emax if Emax is not None else dc.Emax 3855 self.Emax = Emax if Emax is not None else dc.Emax
3851 self.capitals = capitals if capitals is not None else dc.capitals 3856 self.capitals = capitals if capitals is not None else dc.capitals
3852 self.clamp = clamp if clamp is not None else dc.clamp 3857 self.clamp = clamp if clamp is not None else dc.clamp
3853 3858
3854 if _ignored_flags is None: 3859 if _ignored_flags is None:
3855 self._ignored_flags = [] 3860 self._ignored_flags = []
3856 else: 3861 else:
3857 self._ignored_flags = _ignored_flags 3862 self._ignored_flags = _ignored_flags
3858 3863
3859 if traps is None: 3864 if traps is None:
3860 self.traps = dc.traps.copy() 3865 self.traps = dc.traps.copy()
3861 elif not isinstance(traps, dict): 3866 elif not isinstance(traps, dict):
3862 self.traps = dict((s, int(s in traps)) for s in _signals) 3867 self.traps = dict((s, int(s in traps)) for s in _signals + traps)
3863 else: 3868 else:
3864 self.traps = traps 3869 self.traps = traps
3865 3870
3866 if flags is None: 3871 if flags is None:
3867 self.flags = dict.fromkeys(_signals, 0) 3872 self.flags = dict.fromkeys(_signals, 0)
3868 elif not isinstance(flags, dict): 3873 elif not isinstance(flags, dict):
3869 self.flags = dict((s, int(s in flags)) for s in _signals) 3874 self.flags = dict((s, int(s in flags)) for s in _signals + flags)
3870 else: 3875 else:
3871 self.flags = flags 3876 self.flags = flags
3877
3878 def _set_integer_check(self, name, value, vmin, vmax):
3879 if not isinstance(value, int):
3880 raise TypeError("%s must be an integer" % name)
3881 if vmin == '-inf':
3882 if value > vmax:
3883 raise ValueError("%s must be in [%s, %d]. got: %s" % (name, vmin , vmax, value))
3884 elif vmax == 'inf':
3885 if value < vmin:
3886 raise ValueError("%s must be in [%d, %s]. got: %s" % (name, vmin , vmax, value))
3887 else:
3888 if value < vmin or value > vmax:
3889 raise ValueError("%s must be in [%d, %d]. got %s" % (name, vmin, vmax, value))
3890 return object.__setattr__(self, name, value)
3891
3892 def _set_signal_dict(self, name, d):
3893 if not isinstance(d, dict):
3894 raise TypeError("%s must be a signal dict" % d)
3895 for key in d:
3896 if not key in _signals:
3897 raise KeyError("%s is not a valid signal dict" % d)
3898 for key in _signals:
3899 if not key in d:
3900 raise KeyError("%s is not a valid signal dict" % d)
3901 return object.__setattr__(self, name, d)
3902
3903 def __setattr__(self, name, value):
3904 if name == 'prec':
3905 return self._set_integer_check(name, value, 1, 'inf')
3906 elif name == 'Emin':
3907 return self._set_integer_check(name, value, '-inf', 0)
3908 elif name == 'Emax':
3909 return self._set_integer_check(name, value, 0, 'inf')
3910 elif name == 'capitals':
3911 return self._set_integer_check(name, value, 0, 1)
3912 elif name == 'clamp':
3913 return self._set_integer_check(name, value, 0, 1)
3914 elif name == 'rounding':
3915 if not value in _rounding_modes:
3916 # raise TypeError even for strings to have consistency
3917 # among various implementations.
3918 raise TypeError("%s: invalid rounding mode" % value)
3919 return object.__setattr__(self, name, value)
3920 elif name == 'flags' or name == 'traps':
3921 return self._set_signal_dict(name, value)
3922 elif name == '_ignored_flags':
3923 return object.__setattr__(self, name, value)
3924 else:
3925 raise AttributeError(
3926 "'decimal.Context' object has no attribute '%s'" % name)
3927
3928 def __delattr__(self, name):
3929 raise AttributeError("%s cannot be deleted" % name)
3930
3931 # Support for pickling, copy, and deepcopy
3932 def __reduce__(self):
3933 flags = [sig for sig, v in self.flags.items() if v]
3934 traps = [sig for sig, v in self.traps.items() if v]
3935 return (self.__class__,
3936 (self.prec, self.rounding, self.Emin, self.Emax,
3937 self.capitals, self.clamp, flags, traps))
3872 3938
3873 def __repr__(self): 3939 def __repr__(self):
3874 """Show the current context.""" 3940 """Show the current context."""
3875 s = [] 3941 s = []
3876 s.append('Context(prec=%(prec)d, rounding=%(rounding)s, ' 3942 s.append('Context(prec=%(prec)d, rounding=%(rounding)s, '
3877 'Emin=%(Emin)d, Emax=%(Emax)d, capitals=%(capitals)d, ' 3943 'Emin=%(Emin)d, Emax=%(Emax)d, capitals=%(capitals)d, '
3878 'clamp=%(clamp)d' 3944 'clamp=%(clamp)d'
3879 % vars(self)) 3945 % vars(self))
3880 names = [f.__name__ for f, v in self.flags.items() if v] 3946 names = [f.__name__ for f, v in self.flags.items() if v]
3881 s.append('flags=[' + ', '.join(names) + ']') 3947 s.append('flags=[' + ', '.join(names) + ']')
3882 names = [t.__name__ for t, v in self.traps.items() if v] 3948 names = [t.__name__ for t, v in self.traps.items() if v]
3883 s.append('traps=[' + ', '.join(names) + ']') 3949 s.append('traps=[' + ', '.join(names) + ']')
3884 return ', '.join(s) + ')' 3950 return ', '.join(s) + ')'
3885 3951
3886 def clear_flags(self): 3952 def clear_flags(self):
3887 """Reset all flags to zero""" 3953 """Reset all flags to zero"""
3888 for flag in self.flags: 3954 for flag in self.flags:
3889 self.flags[flag] = 0 3955 self.flags[flag] = 0
3890 3956
3891 def _shallow_copy(self): 3957 def _shallow_copy(self):
3892 """Returns a shallow copy from self.""" 3958 """Returns a shallow copy from self."""
3893 nc = Context(self.prec, self.rounding, self.traps, 3959 nc = Context(self.prec, self.rounding, self.Emin, self.Emax,
3894 self.flags, self.Emin, self.Emax, 3960 self.capitals, self.clamp, self.flags, self.traps,
3895 self.capitals, self.clamp, self._ignored_flags) 3961 self._ignored_flags)
3896 return nc 3962 return nc
3897 3963
3898 def copy(self): 3964 def copy(self):
3899 """Returns a deep copy from self.""" 3965 """Returns a deep copy from self."""
3900 nc = Context(self.prec, self.rounding, self.traps.copy(), 3966 nc = Context(self.prec, self.rounding, self.Emin, self.Emax,
3901 self.flags.copy(), self.Emin, self.Emax, 3967 self.capitals, self.clamp,
3902 self.capitals, self.clamp, self._ignored_flags) 3968 self.flags.copy(), self.traps.copy(),
3969 self._ignored_flags)
3903 return nc 3970 return nc
3904 __copy__ = copy 3971 __copy__ = copy
3905 3972
3906 def _raise_error(self, condition, explanation = None, *args): 3973 def _raise_error(self, condition, explanation = None, *args):
3907 """Handles an error 3974 """Handles an error
3908 3975
3909 If the flag is in _ignored_flags, returns the default response. 3976 If the flag is in _ignored_flags, returns the default response.
3910 Otherwise, it sets the flag, then, if the corresponding 3977 Otherwise, it sets the flag, then, if the corresponding
3911 trap_enabler is set, it reraises the exception. Otherwise, it returns 3978 trap_enabler is set, it reraises the exception. Otherwise, it returns
3912 the default value after setting the flag. 3979 the default value after setting the flag.
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
4055 4122
4056 def canonical(self, a): 4123 def canonical(self, a):
4057 """Returns the same Decimal object. 4124 """Returns the same Decimal object.
4058 4125
4059 As we do not have different encodings for the same number, the 4126 As we do not have different encodings for the same number, the
4060 received object already is in its canonical form. 4127 received object already is in its canonical form.
4061 4128
4062 >>> ExtendedContext.canonical(Decimal('2.50')) 4129 >>> ExtendedContext.canonical(Decimal('2.50'))
4063 Decimal('2.50') 4130 Decimal('2.50')
4064 """ 4131 """
4132 if not isinstance(a, Decimal):
4133 raise TypeError("canonical requires a Decimal as an argument.")
4065 return a.canonical(context=self) 4134 return a.canonical(context=self)
4066 4135
4067 def compare(self, a, b): 4136 def compare(self, a, b):
4068 """Compares values numerically. 4137 """Compares values numerically.
4069 4138
4070 If the signs of the operands differ, a value representing each operand 4139 If the signs of the operands differ, a value representing each operand
4071 ('-1' if the operand is less than zero, '0' if the operand is zero or 4140 ('-1' if the operand is less than zero, '0' if the operand is zero or
4072 negative zero, or '1' if the operand is greater than zero) is used in 4141 negative zero, or '1' if the operand is greater than zero) is used in
4073 place of that operand for the comparison instead of the actual 4142 place of that operand for the comparison instead of the actual
4074 operand. 4143 operand.
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
4365 4434
4366 def is_canonical(self, a): 4435 def is_canonical(self, a):
4367 """Return True if the operand is canonical; otherwise return False. 4436 """Return True if the operand is canonical; otherwise return False.
4368 4437
4369 Currently, the encoding of a Decimal instance is always 4438 Currently, the encoding of a Decimal instance is always
4370 canonical, so this method returns True for any Decimal. 4439 canonical, so this method returns True for any Decimal.
4371 4440
4372 >>> ExtendedContext.is_canonical(Decimal('2.50')) 4441 >>> ExtendedContext.is_canonical(Decimal('2.50'))
4373 True 4442 True
4374 """ 4443 """
4444 if not isinstance(a, Decimal):
4445 raise TypeError("is_canonical requires a Decimal as an argument.")
4375 return a.is_canonical() 4446 return a.is_canonical()
4376 4447
4377 def is_finite(self, a): 4448 def is_finite(self, a):
4378 """Return True if the operand is finite; otherwise return False. 4449 """Return True if the operand is finite; otherwise return False.
4379 4450
4380 A Decimal instance is considered finite if it is neither 4451 A Decimal instance is considered finite if it is neither
4381 infinite nor a NaN. 4452 infinite nor a NaN.
4382 4453
4383 >>> ExtendedContext.is_finite(Decimal('2.50')) 4454 >>> ExtendedContext.is_finite(Decimal('2.50'))
4384 True 4455 True
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
4957 -NaN 5028 -NaN
4958 -Infinity 5029 -Infinity
4959 -Normal 5030 -Normal
4960 -Subnormal 5031 -Subnormal
4961 -Zero 5032 -Zero
4962 +Zero 5033 +Zero
4963 +Subnormal 5034 +Subnormal
4964 +Normal 5035 +Normal
4965 +Infinity 5036 +Infinity
4966 5037
4967 >>> c = Context(ExtendedContext) 5038 >>> c = ExtendedContext.copy()
4968 >>> c.Emin = -999 5039 >>> c.Emin = -999
4969 >>> c.Emax = 999 5040 >>> c.Emax = 999
4970 >>> c.number_class(Decimal('Infinity')) 5041 >>> c.number_class(Decimal('Infinity'))
4971 '+Infinity' 5042 '+Infinity'
4972 >>> c.number_class(Decimal('1E-10')) 5043 >>> c.number_class(Decimal('1E-10'))
4973 '+Normal' 5044 '+Normal'
4974 >>> c.number_class(Decimal('2.50')) 5045 >>> c.number_class(Decimal('2.50'))
4975 '+Normal' 5046 '+Normal'
4976 >>> c.number_class(Decimal('0.1E-999')) 5047 >>> c.number_class(Decimal('0.1E-999'))
4977 '+Subnormal' 5048 '+Subnormal'
(...skipping 1274 matching lines...) Expand 10 before | Expand all | Expand 10 after
6252 # _SignedInfinity[sign] is infinity w/ that sign 6323 # _SignedInfinity[sign] is infinity w/ that sign
6253 _SignedInfinity = (_Infinity, _NegativeInfinity) 6324 _SignedInfinity = (_Infinity, _NegativeInfinity)
6254 6325
6255 # Constants related to the hash implementation; hash(x) is based 6326 # Constants related to the hash implementation; hash(x) is based
6256 # on the reduction of x modulo _PyHASH_MODULUS 6327 # on the reduction of x modulo _PyHASH_MODULUS
6257 import sys 6328 import sys
6258 _PyHASH_MODULUS = sys.hash_info.modulus 6329 _PyHASH_MODULUS = sys.hash_info.modulus
6259 # hash values to use for positive and negative infinities, and nans 6330 # hash values to use for positive and negative infinities, and nans
6260 _PyHASH_INF = sys.hash_info.inf 6331 _PyHASH_INF = sys.hash_info.inf
6261 _PyHASH_NAN = sys.hash_info.nan 6332 _PyHASH_NAN = sys.hash_info.nan
6262 del sys
6263 6333
6264 # _PyHASH_10INV is the inverse of 10 modulo the prime _PyHASH_MODULUS 6334 # _PyHASH_10INV is the inverse of 10 modulo the prime _PyHASH_MODULUS
6265 _PyHASH_10INV = pow(10, _PyHASH_MODULUS - 2, _PyHASH_MODULUS) 6335 _PyHASH_10INV = pow(10, _PyHASH_MODULUS - 2, _PyHASH_MODULUS)
6336 del sys
6266 6337
6338 try:
6339 import _decimal
6340 except ImportError:
6341 pass
6342 else:
6343 s1 = set(dir())
6344 s2 = set(dir(_decimal))
6345 for name in s1 - s2:
6346 del globals()[name]
6347 del s1, s2, name
6348 from _decimal import *
6267 6349
6268 if __name__ == '__main__': 6350 if __name__ == '__main__':
6269 import doctest, decimal 6351 import doctest, decimal
6270 doctest.testmod(decimal) 6352 doctest.testmod(decimal)
OLDNEW
« no previous file with comments | « Include/longintrepr.h ('k') | Lib/test/support.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+