
python-checkins at python
Aug 17, 2012, 2:14 PM
Post #1 of 1
(29 views)
Permalink
|
|
cpython: Closes #15632: regrtest.py: fix spurious refleaks due to various caches
|
|
http://hg.python.org/cpython/rev/dc18d73e67a5 changeset: 78625:dc18d73e67a5 user: Stefan Krah <skrah [at] bytereef> date: Fri Aug 17 23:09:48 2012 +0200 summary: Closes #15632: regrtest.py: fix spurious refleaks due to various caches filling up with random data. files: Lib/test/regrtest.py | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -381,9 +381,9 @@ huntrleaks[1] = int(huntrleaks[1]) if len(huntrleaks) == 2 or not huntrleaks[2]: huntrleaks[2:] = ["reflog.txt"] - # Avoid false positives due to the character cache in - # stringobject.c filling slowly with random data - warm_char_cache() + # Avoid false positives due to various caches + # filling slowly with random data: + warm_caches() elif o in ('-M', '--memlimit'): support.set_memlimit(a) elif o in ('-u', '--use'): @@ -1430,10 +1430,15 @@ # Collect cyclic trash. gc.collect() -def warm_char_cache(): +def warm_caches(): + # char cache s = bytes(range(256)) for i in range(256): s[i:i+1] + # unicode cache + x = [chr(i) for i in range(256)] + # int cache + x = list(range(-5, 257)) def findtestdir(path=None): return path or os.path.dirname(__file__) or os.curdir -- Repository URL: http://hg.python.org/cpython
|