diff options
author | Stefan Krah <skrah@bytereef.org> | 2020-06-08 23:57:11 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-08 23:57:11 (GMT) |
commit | 0f5a28f834bdac2da8a04597dc0fc5b71e50da9d (patch) | |
tree | 3377347e6b3a21d3c2fe4e309ecf59d5b2854523 /Lib/test | |
parent | 32c1fb07e6f2ded90e5dd24d4b46b7aa7a795d2e (diff) | |
download | cpython-0f5a28f834bdac2da8a04597dc0fc5b71e50da9d.zip cpython-0f5a28f834bdac2da8a04597dc0fc5b71e50da9d.tar.gz cpython-0f5a28f834bdac2da8a04597dc0fc5b71e50da9d.tar.bz2 |
[3.8] Revert bpo-39576: Prevent memory error for overly optimistic precisions (GH-20747)
This reverts commit b6271025c640c228505dc9f194362a0c2ab81c61.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_decimal.py | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py index 0e9cd30..1f37b53 100644 --- a/Lib/test/test_decimal.py +++ b/Lib/test/test_decimal.py @@ -5476,41 +5476,6 @@ class CWhitebox(unittest.TestCase): self.assertEqual(Decimal.from_float(cls(101.1)), Decimal.from_float(101.1)) - def test_maxcontext_exact_arith(self): - - # Make sure that exact operations do not raise MemoryError due - # to huge intermediate values when the context precision is very - # large. - - # The following functions fill the available precision and are - # therefore not suitable for large precisions (by design of the - # specification). - MaxContextSkip = ['logical_invert', 'next_minus', 'next_plus', - 'logical_and', 'logical_or', 'logical_xor', - 'next_toward', 'rotate', 'shift'] - - Decimal = C.Decimal - Context = C.Context - localcontext = C.localcontext - - # Here only some functions that are likely candidates for triggering a - # MemoryError are tested. deccheck.py has an exhaustive test. - maxcontext = Context(prec=C.MAX_PREC, Emin=C.MIN_EMIN, Emax=C.MAX_EMAX) - with localcontext(maxcontext): - self.assertEqual(Decimal(0).exp(), 1) - self.assertEqual(Decimal(1).ln(), 0) - self.assertEqual(Decimal(1).log10(), 0) - self.assertEqual(Decimal(10**2).log10(), 2) - self.assertEqual(Decimal(10**223).log10(), 223) - self.assertEqual(Decimal(10**19).logb(), 19) - self.assertEqual(Decimal(4).sqrt(), 2) - self.assertEqual(Decimal("40E9").sqrt(), Decimal('2.0E+5')) - self.assertEqual(divmod(Decimal(10), 3), (3, 1)) - self.assertEqual(Decimal(10) // 3, 3) - self.assertEqual(Decimal(4) / 2, 2) - self.assertEqual(Decimal(400) ** -1, Decimal('0.0025')) - - @requires_docstrings @unittest.skipUnless(C, "test requires C version") class SignatureTest(unittest.TestCase): |