1919# kind of outer loop.
2020protocols = range (pickle .HIGHEST_PROTOCOL + 1 )
2121
22- ascii_char_size = 1
23-
2422
2523# Return True if opcode code appears in the pickle, else False.
2624def opcode_in_pickle (code , pickle ):
@@ -1331,7 +1329,7 @@ class BigmemPickleTests(unittest.TestCase):
13311329
13321330 # Binary protocols can serialize longs of up to 2GB-1
13331331
1334- @bigmemtest (size = _2G , memuse = 1 + 1 , dry_run = False )
1332+ @bigmemtest (size = _2G , memuse = 3.6 , dry_run = False )
13351333 def test_huge_long_32b (self , size ):
13361334 data = 1 << (8 * size )
13371335 try :
@@ -1347,7 +1345,7 @@ def test_huge_long_32b(self, size):
13471345 # (older protocols don't have a dedicated opcode for bytes and are
13481346 # too inefficient)
13491347
1350- @bigmemtest (size = _2G , memuse = 1 + 1 , dry_run = False )
1348+ @bigmemtest (size = _2G , memuse = 2.5 , dry_run = False )
13511349 def test_huge_bytes_32b (self , size ):
13521350 data = b"abcd" * (size // 4 )
13531351 try :
@@ -1363,7 +1361,7 @@ def test_huge_bytes_32b(self, size):
13631361 finally :
13641362 data = None
13651363
1366- @bigmemtest (size = _4G , memuse = 1 + 1 , dry_run = False )
1364+ @bigmemtest (size = _4G , memuse = 2.5 , dry_run = False )
13671365 def test_huge_bytes_64b (self , size ):
13681366 data = b"a" * size
13691367 try :
@@ -1378,7 +1376,7 @@ def test_huge_bytes_64b(self, size):
13781376 # All protocols use 1-byte per printable ASCII character; we add another
13791377 # byte because the encoded form has to be copied into the internal buffer.
13801378
1381- @bigmemtest (size = _2G , memuse = 2 + ascii_char_size , dry_run = False )
1379+ @bigmemtest (size = _2G , memuse = 8 , dry_run = False )
13821380 def test_huge_str_32b (self , size ):
13831381 data = "abcd" * (size // 4 )
13841382 try :
@@ -1395,7 +1393,7 @@ def test_huge_str_32b(self, size):
13951393 # BINUNICODE (protocols 1, 2 and 3) cannot carry more than
13961394 # 2**32 - 1 bytes of utf-8 encoded unicode.
13971395
1398- @bigmemtest (size = _4G , memuse = 1 + ascii_char_size , dry_run = False )
1396+ @bigmemtest (size = _4G , memuse = 8 , dry_run = False )
13991397 def test_huge_str_64b (self , size ):
14001398 data = "a" * size
14011399 try :
0 commit comments