[pypy-commit] pypy default: Try to fix this test, failing on 32-bit since the utf-8 merge

arigo pypy.commits at gmail.com
Mon Apr 29 03:43:42 EDT 2019


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r96548:a4ec9f051cba
Date: 2019-04-29 09:43 +0200
http://bitbucket.org/pypy/pypy/changeset/a4ec9f051cba/

Log:	Try to fix this test, failing on 32-bit since the utf-8 merge

diff --git a/lib-python/2.7/test/test_unicode.py b/lib-python/2.7/test/test_unicode.py
--- a/lib-python/2.7/test/test_unicode.py
+++ b/lib-python/2.7/test/test_unicode.py
@@ -1652,10 +1652,10 @@
         # when a string allocation fails with a MemoryError.
         # This used to crash the interpreter,
         # or leak references when the number was smaller.
-        charwidth = 4 if sys.maxunicode >= 0x10000 else 2
+        charwidth = 2   # pypy: the char \u0123 is stored in two utf-8 bytes
         # Note: sys.maxsize is half of the actual max allocation because of
         # the signedness of Py_ssize_t.
-        alloc = lambda: u"a" * (sys.maxsize // charwidth * 2)
+        alloc = lambda: u"\u0123" * (sys.maxsize // charwidth * 2)
         self.assertRaises(MemoryError, alloc)
         self.assertRaises(MemoryError, alloc)
 


More information about the pypy-commit mailing list