Issue 3601: test_unicode.test_raiseMemError fails in UCS4 (original) (raw)

Created on 2008-08-19 15:42 by benjamin.peterson, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
memerror2.patch pitrou,2008-08-23 19:46
Messages (6)
msg71429 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2008-08-19 15:42
====================================================================== ERROR: test_raiseMemError (test.test_unicode.UnicodeTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/temp/python/trunk/Lib/test/test_unicode.py", line 1122, in test_raiseMemError self.assertRaises(MemoryError, alloc) File "/temp/python/trunk/Lib/unittest.py", line 336, in failUnlessRaises callableObj(*args, **kwargs) File "/temp/python/trunk/Lib/test/test_unicode.py", line 1121, in alloc = lambda: u"a" * (sys.maxsize - 100) OverflowError: repeated string is too long ----------------------------------------------------------------------
msg71433 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2008-08-19 16:02
Ok, please disable the test for now, I have more important things to do for the beta :)
msg71434 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2008-08-19 16:03
Oh. Sorry, I didn't mean to assign it to you anyway.
msg71436 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2008-08-19 16:07
(the fix is probably trivial, it involves dividing sys.maxsize by the number of bytes of an unicode character, something like: width = sys.getsizeof("a") - sys.getsizeof("") alloc = lambda: u"a" * (sys.maxsize // width) self.assertRaises(MemoryError, alloc) self.assertRaises(MemoryError, alloc) you can give it a try if you want ;-))
msg71809 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2008-08-23 19:46
This patch is ok on both UCS2 and UCS4 builds (on 32-bit machines). Someone should test it on a 64-bit machine.
msg72635 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2008-09-05 22:13
Fixed in r66235, r66236.
History
Date User Action Args
2022-04-11 14:56:37 admin set github: 47851
2008-09-05 22:13:28 pitrou set status: open -> closedresolution: fixedmessages: +
2008-08-23 19:46:26 pitrou set keywords: + patch, needs reviewfiles: + memerror2.patchmessages: +
2008-08-21 14:11:34 pitrou set assignee: pitrou
2008-08-19 16:07:59 pitrou set messages: +
2008-08-19 16:03:56 benjamin.peterson set assignee: pitrou -> (no value)messages: +
2008-08-19 16:02:36 pitrou set priority: critical -> hightype: behaviormessages: + components: + Testsversions: + Python 2.6, Python 3.0
2008-08-19 15:42:05 benjamin.peterson create