Commits

Serhiy Storchaka committed 38a10d0

Fix memory error in test_ucn.
unicode-escape decoder requires memory for result corresponding to input size.
Fixes test for issue #16335.

Comments (0)

Files changed (1)

Lib/test/test_ucn.py

         # very very long bogus character name
         try:
             x = b'\\N{SPACE' + b'x' * int(_testcapi.UINT_MAX + 1) + b'}'
+            self.assertEqual(len(x), len(b'\\N{SPACE}') +
+                                     (_testcapi.UINT_MAX + 1))
+            self.assertRaisesRegexp(UnicodeError,
+                'unknown Unicode character name',
+                x.decode, 'unicode-escape'
+            )
         except MemoryError:
             raise unittest.SkipTest("not enough memory")
-        self.assertEqual(len(x), len(b'\\N{SPACE}') + (_testcapi.UINT_MAX + 1))
-        self.assertRaisesRegexp(UnicodeError,
-            'unknown Unicode character name',
-            x.decode, 'unicode-escape'
-        )
 
 
 def test_main():
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.