aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_memoryio.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-12-15 14:11:43 +0200
committerGitHub <noreply@github.com>2017-12-15 14:11:43 +0200
commit2e3f5701858d1fc04caedefdd9a8ea43810270d2 (patch)
treee1c92b967a8f0935f65139338f4b7c170609c46e /Lib/test/test_memoryio.py
parenta5552f023e1d8cbafee1e51d316cc581deb2295f (diff)
downloadcpython-2e3f5701858d1fc04caedefdd9a8ea43810270d2.tar.gz
cpython-2e3f5701858d1fc04caedefdd9a8ea43810270d2.zip
bpo-30416: Protect the optimizer during constant folding. (#4860)
It no longer spends much time doing complex calculations and no longer consumes much memory for creating large constants that will be dropped later. This fixes also bpo-21074.
Diffstat (limited to 'Lib/test/test_memoryio.py')
-rw-r--r--Lib/test/test_memoryio.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/test/test_memoryio.py b/Lib/test/test_memoryio.py
index e16c57e9435..cd2faba1791 100644
--- a/Lib/test/test_memoryio.py
+++ b/Lib/test/test_memoryio.py
@@ -759,7 +759,8 @@ class CBytesIOTest(PyBytesIOTest):
check = self.check_sizeof
self.assertEqual(object.__sizeof__(io.BytesIO()), basesize)
check(io.BytesIO(), basesize )
- check(io.BytesIO(b'a' * 1000), basesize + sys.getsizeof(b'a' * 1000))
+ n = 1000 # use a variable to prevent constant folding
+ check(io.BytesIO(b'a' * n), basesize + sys.getsizeof(b'a' * n))
# Various tests of copy-on-write behaviour for BytesIO.