From: Zachary Ware Date: Thu, 8 Sep 2022 18:52:07 +0000 (-0500) Subject: gh-96465: Clear fractions hash lru_cache under refleak testing (GH-96689) X-Git-Tag: v3.12.0a1~444 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9c8f3794337457b1d905a9fa0f38c2978fe32abd;p=thirdparty%2FPython%2Fcpython.git gh-96465: Clear fractions hash lru_cache under refleak testing (GH-96689) Automerge-Triggered-By: GH:zware --- diff --git a/Lib/test/libregrtest/utils.py b/Lib/test/libregrtest/utils.py index 8578a028c78b..332dcc4c6db2 100644 --- a/Lib/test/libregrtest/utils.py +++ b/Lib/test/libregrtest/utils.py @@ -210,3 +210,10 @@ def clear_caches(): else: for f in typing._cleanups: f() + + try: + fractions = sys.modules['fractions'] + except KeyError: + pass + else: + fractions._hash_algorithm.cache_clear()