This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test_tcl memory leak
Type: resource usage Stage: resolved
Components: Library (Lib), Tests, Tkinter Versions: Python 3.3, Python 3.4, Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: pitrou Nosy List: pitrou, python-dev, serhiy.storchaka
Priority: normal Keywords:

Created on 2014-02-23 17:13 by pitrou, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (7)
msg212006 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2014-02-23 17:13
Witnessed on 2.7, 3.3, 3.4:

$ ./python -m test -uall -R3:3 test_tcl 
[1/1] test_tcl
beginning 6 repetitions
123456
......
test_tcl leaked [12, 12, 12] references, sum=36
test_tcl leaked [5, 5, 5] memory blocks, sum=15
msg212012 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2014-02-23 18:05
This actually appeared with 89b738e3d0c9, i.e. it's not a regression but an existing leak that was uncovered by a new test.
msg212013 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2014-02-23 18:13
Actually, this looks mostly like a cleanup issue in the tests. Following patch seems to solve it:

diff --git a/Lib/test/test_tcl.py b/Lib/test/test_tcl.py
--- a/Lib/test/test_tcl.py
+++ b/Lib/test/test_tcl.py
@@ -376,6 +376,7 @@ class TclTest(unittest.TestCase):
             result = arg
             return arg
         self.interp.createcommand('testfunc', testfunc)
+        self.addCleanup(self.interp.tk.deletecommand, 'testfunc')
         def check(value, expected, eq=self.assertEqual):
             r = self.interp.call('testfunc', value)
             self.assertIsInstance(result, str)
msg212016 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-02-23 18:37
LGTM.

There is a little related but more complex issue1524639.
msg212017 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-02-23 18:41
New changeset 38a06e411698 by Antoine Pitrou in branch '3.3':
Issue #20743: Fix a reference leak in test_tcl.
http://hg.python.org/cpython/rev/38a06e411698

New changeset 10b1f60a72fa by Antoine Pitrou in branch 'default':
Issue #20743: Fix a reference leak in test_tcl.
http://hg.python.org/cpython/rev/10b1f60a72fa
msg212018 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-02-23 18:46
New changeset 00393de6919d by Antoine Pitrou in branch '2.7':
Issue #20743: Fix a reference leak in test_tcl.
http://hg.python.org/cpython/rev/00393de6919d
msg212019 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2014-02-23 18:48
Ok, fixed now.
History
Date User Action Args
2022-04-11 14:57:59adminsetgithub: 64942
2014-02-23 18:48:05pitrousetstatus: open -> closed
resolution: not a bug
messages: + msg212019

stage: commit review -> resolved
2014-02-23 18:46:30python-devsetmessages: + msg212018
2014-02-23 18:41:58python-devsetnosy: + python-dev
messages: + msg212017
2014-02-23 18:37:28serhiy.storchakasetassignee: pitrou
messages: + msg212016
stage: needs patch -> commit review
2014-02-23 18:13:12pitrousetpriority: high -> normal
components: + Tests
2014-02-23 18:13:04pitrousetmessages: + msg212013
2014-02-23 18:05:15pitrousetmessages: + msg212012
2014-02-23 17:13:45pitroucreate