[Python-checkins] gh-96465: Clear fractions hash lru_cache under refleak testing (GH-96689)

miss-islington webhook-mailer at python.org
Thu Sep 8 14:52:16 EDT 2022


https://github.com/python/cpython/commit/9c8f3794337457b1d905a9fa0f38c2978fe32abd
commit: 9c8f3794337457b1d905a9fa0f38c2978fe32abd
branch: main
author: Zachary Ware <zach at python.org>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2022-09-08T11:52:07-07:00
summary:

gh-96465: Clear fractions hash lru_cache under refleak testing (GH-96689)



Automerge-Triggered-By: GH:zware

files:
M Lib/test/libregrtest/utils.py

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()



More information about the Python-checkins mailing list