[Python-checkins] bpo-45160: Fix refleak in test_ttk_guionly introduced in GH-28291 (GH-29416) (GH-29421)

ambv webhook-mailer at python.org
Fri Nov 5 06:00:23 EDT 2021


https://github.com/python/cpython/commit/099a94fba3f9437e29d16ed54215ec8cf65de868
commit: 099a94fba3f9437e29d16ed54215ec8cf65de868
branch: 3.10
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: ambv <lukasz at langa.pl>
date: 2021-11-05T11:00:18+01:00
summary:

bpo-45160: Fix refleak in test_ttk_guionly introduced in GH-28291 (GH-29416) (GH-29421)

(cherry picked from commit 54d1e3f72ed1ad8e860888c30ee7a285b931c0d1)

Co-authored-by: Łukasz Langa <lukasz at langa.pl>

files:
M Lib/tkinter/test/test_ttk/test_extensions.py

diff --git a/Lib/tkinter/test/test_ttk/test_extensions.py b/Lib/tkinter/test/test_ttk/test_extensions.py
index cddd1f2e84834..7fc1ebb95c970 100644
--- a/Lib/tkinter/test/test_ttk/test_extensions.py
+++ b/Lib/tkinter/test/test_ttk/test_extensions.py
@@ -310,9 +310,12 @@ def cb_test(*args):
             self.assertEqual(textvar.get(), items[1])
             success.append(True)
         optmenu = ttk.OptionMenu(self.root, textvar, "a", *items)
-        textvar.trace("w", cb_test)
+        optmenu.pack()
+        cb_name = textvar.trace("w", cb_test)
         optmenu['menu'].invoke(1)
         self.assertEqual(success, [True])
+        textvar.trace_vdelete("w", cb_name)
+        optmenu.destroy()
 
 
 class DefaultRootTest(AbstractDefaultRootTest, unittest.TestCase):



More information about the Python-checkins mailing list