summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Krah <skrah@bytereef.org>2012-08-17 21:09:48 (GMT)
committerStefan Krah <skrah@bytereef.org>2012-08-17 21:09:48 (GMT)
commit5c3ddc8066993199a6af25ce9011ae587a60117b (patch)
treedfaf85abf0440e8a984a16e7702ac55cd1dc7ab8
parent6aaa03a9015cac1c1a7ce98b2531c106a15c9de0 (diff)
downloadcpython-5c3ddc8066993199a6af25ce9011ae587a60117b.zip
cpython-5c3ddc8066993199a6af25ce9011ae587a60117b.tar.gz
cpython-5c3ddc8066993199a6af25ce9011ae587a60117b.tar.bz2
Closes #15632: regrtest.py: fix spurious refleaks due to various caches
filling up with random data.
-rwxr-xr-xLib/test/regrtest.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
index c9ef0ff..e977e42 100755
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -381,9 +381,9 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
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 @@ def dash_R_cleanup(fs, ps, pic, zdc, abcs):
# 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