From 9c8f3794337457b1d905a9fa0f38c2978fe32abd Mon Sep 17 00:00:00 2001 From: Zachary Ware Date: Thu, 8 Sep 2022 13:52:07 -0500 Subject: [PATCH] gh-96465: Clear fractions hash lru_cache under refleak testing (GH-96689) Automerge-Triggered-By: GH:zware --- Lib/test/libregrtest/utils.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Lib/test/libregrtest/utils.py b/Lib/test/libregrtest/utils.py index 8578a028c78bc2..332dcc4c6db247 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()