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,11 @@ 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 + # Avoid false positives due to various caches + # filling slowly with random data: warm_char_cache() + warm_unicode_cache() + warm_int_cache() elif o in ('-M', '--memlimit'): support.set_memlimit(a) elif o in ('-u', '--use'): @@ -1435,6 +1437,12 @@ for i in range(256): s[i:i+1] +def warm_unicode_cache(): + x = [chr(i) for i in range(256)] + +def warm_int_cache(): + x = list(range(-5, 257)) + def findtestdir(path=None): return path or os.path.dirname(__file__) or os.curdir