diff options
author | Stefan Krah <skrah@bytereef.org> | 2014-09-10 15:58:15 (GMT) |
---|---|---|
committer | Stefan Krah <skrah@bytereef.org> | 2014-09-10 15:58:15 (GMT) |
commit | b578f8a1efdb8ad5b6671427d3a49f4eef5e5b70 (patch) | |
tree | 4406bd8c0c25536ea07bdac4712c05766e40ab5c /Modules/_decimal | |
parent | 082a9b1274ae61011e97b5c7e424e0e438114123 (diff) | |
download | cpython-b578f8a1efdb8ad5b6671427d3a49f4eef5e5b70.zip cpython-b578f8a1efdb8ad5b6671427d3a49f4eef5e5b70.tar.gz cpython-b578f8a1efdb8ad5b6671427d3a49f4eef5e5b70.tar.bz2 |
Issue #19232: Speed up decimal import. Additionally, since _decimal is
self-contained, this change facilitates maintenance and the Python version
can be easily imported for experimentation.
Diffstat (limited to 'Modules/_decimal')
-rw-r--r-- | Modules/_decimal/tests/deccheck.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Modules/_decimal/tests/deccheck.py b/Modules/_decimal/tests/deccheck.py index c4c5a44..89433c0 100644 --- a/Modules/_decimal/tests/deccheck.py +++ b/Modules/_decimal/tests/deccheck.py @@ -36,6 +36,7 @@ from test.support import import_fresh_module from randdec import randfloat, all_unary, all_binary, all_ternary from randdec import unary_optarg, binary_optarg, ternary_optarg from formathelper import rand_format, rand_locale +from _pydecimal import _dec_from_triple C = import_fresh_module('decimal', fresh=['_decimal']) P = import_fresh_module('decimal', blocked=['_decimal']) @@ -370,7 +371,7 @@ class SkipHandler: return abs(a - b) def standard_ulp(self, dec, prec): - return P._dec_from_triple(0, '1', dec._exp+len(dec._int)-prec) + return _dec_from_triple(0, '1', dec._exp+len(dec._int)-prec) def rounding_direction(self, x, mode): """Determine the effective direction of the rounding when @@ -401,10 +402,10 @@ class SkipHandler: # Convert infinities to the largest representable number + 1. x = exact if exact.is_infinite(): - x = P._dec_from_triple(exact._sign, '10', context.p.Emax) + x = _dec_from_triple(exact._sign, '10', context.p.Emax) y = rounded if rounded.is_infinite(): - y = P._dec_from_triple(rounded._sign, '10', context.p.Emax) + y = _dec_from_triple(rounded._sign, '10', context.p.Emax) # err = (rounded - exact) / ulp(rounded) self.maxctx.prec = p * 2 |