Skip to content

Commit c9da089

Browse files
Issue python#19886: Use better estimated memory requirements for bigmem tests.
Incorrect requirements can cause memory swapping.
1 parent 9f8621f commit c9da089

File tree

3 files changed

+12
-20
lines changed

3 files changed

+12
-20
lines changed

Lib/test/test_hashlib.py

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -207,30 +207,20 @@ def test_case_md5_2(self):
207207
self.check('md5', 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789',
208208
'd174ab98d277d9f5a5611c2c9f419d9f')
209209

210-
@precisionbigmemtest(size=_4G + 5, memuse=1)
210+
@unittest.skipIf(sys.maxsize < _4G + 5, 'test cannot run on 32-bit systems')
211+
@precisionbigmemtest(size=_4G + 5, memuse=1, dry_run=False)
211212
def test_case_md5_huge(self, size):
212-
if size == _4G + 5:
213-
try:
214-
self.check('md5', 'A'*size, 'c9af2dff37468ce5dfee8f2cfc0a9c6d')
215-
except OverflowError:
216-
pass # 32-bit arch
213+
self.check('md5', 'A'*size, 'c9af2dff37468ce5dfee8f2cfc0a9c6d')
217214

218-
@precisionbigmemtest(size=_4G + 5, memuse=1)
215+
@unittest.skipIf(sys.maxsize < _4G + 5, 'test cannot run on 32-bit systems')
216+
@precisionbigmemtest(size=_4G + 5, memuse=1, dry_run=False)
219217
def test_case_md5_huge_update(self, size):
220-
if size == _4G + 5:
221-
try:
222-
self.check_update('md5', 'A'*size,
223-
'c9af2dff37468ce5dfee8f2cfc0a9c6d')
224-
except OverflowError:
225-
pass # 32-bit arch
218+
self.check_update('md5', 'A'*size, 'c9af2dff37468ce5dfee8f2cfc0a9c6d')
226219

227-
@precisionbigmemtest(size=_4G - 1, memuse=1)
220+
@unittest.skipIf(sys.maxsize < _4G - 1, 'test cannot run on 32-bit systems')
221+
@precisionbigmemtest(size=_4G - 1, memuse=1, dry_run=False)
228222
def test_case_md5_uintmax(self, size):
229-
if size == _4G - 1:
230-
try:
231-
self.check('md5', 'A'*size, '28138d306ff1b8281f1a9067e1a1a2b3')
232-
except OverflowError:
233-
pass # 32-bit arch
223+
self.check('md5', 'A'*size, '28138d306ff1b8281f1a9067e1a1a2b3')
234224

235225
# use the three examples from Federal Information Processing Standards
236226
# Publication 180-1, Secure Hash Standard, 1995 April 17

Lib/test/test_marshal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ def test_string(self, size):
286286
self.check_unmarshallable('x' * size)
287287

288288
@test_support.precisionbigmemtest(size=LARGE_SIZE,
289-
memuse=character_size, dry_run=False)
289+
memuse=character_size + 2, dry_run=False)
290290
def test_unicode(self, size):
291291
self.check_unmarshallable(u'x' * size)
292292

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ IDLE
161161
Tests
162162
-----
163163

164+
- Issue #19886: Use better estimated memory requirements for bigmem tests.
165+
164166
- Backported tests for Tkinter variables.
165167

166168
- Issue #19320: test_tcl no longer fails when wantobjects is false.

0 commit comments

Comments
 (0)