summaryrefslogtreecommitdiff
path: root/Modules/_decimal
diff options
context:
space:
mode:
authorStefan Krah <skrah@bytereef.org>2014-09-10 17:58:15 +0200
committerStefan Krah <skrah@bytereef.org>2014-09-10 17:58:15 +0200
commit2464e8b0690ecee10631406787f5195196201619 (patch)
tree0d48a85bc281c224486571fbbb72af3482e315ec /Modules/_decimal
parentcae88832d64d135d056e28ccf9d2f3fed20df435 (diff)
downloadcpython-2464e8b0690ecee10631406787f5195196201619.tar.gz
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.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/Modules/_decimal/tests/deccheck.py b/Modules/_decimal/tests/deccheck.py
index c4c5a4461d..89433c083d 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