Message295846
When Louie Lu posted a link to
https://blog.louie.lu/2017/06/12/diagnosing-and-fixing-reference-leaks-in-cpython/
on core-mentorship list, I tested idlelib.
python -m test -ugui test_idle # SUCCESS, no extraneous output
python -m test -R: test_idle # SUCCESS, no extraneous output
python -m test -R: -ugui test_idle # error output, FAILURE
[So people who leaktest without a screen see nothing in idlelib.]
Error output is about 20 copies of the following:
can't invoke "event" command: application has been destroyed
while executing
"event generate $w <<ThemeChanged>>"
(procedure "ttk::ThemeChanged" line 6)
invoked from within
"ttk::ThemeChanged"
At the end:
test_idle leaked [471, 471, 471, 471] references, sum=1884
test_idle leaked [209, 211, 211, 211] memory blocks, sum=842
[similar for python 3.6]
In a response email, I noted that test_idle gathers tests from idlelib.idle_test.test_* and that something extra is needed to pin leaks to specific test modules.
I don't know whether the absence of 'invoke event' error messages when not running -R means that there are also no refleaks, or not.
---
import os
import subprocess
os.chdir('f:/dev/3x/Lib/idlelib/idle_test')
testfiles = [name for name in os.listdir() if name.startswith('test_')]
for name in testfiles:
os.rename(name, 'x'+name)
for name in testfiles:
os.rename('x'+name, name)
try:
res = subprocess.run(
['f:/dev/3x/python.bat', '-m', 'test', '-R:', '-ugui', 'test_idle'],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
if res.returncode:
print(name)
print(res.stderr)
except Exception as err:
print(name, err)
os.rename(name, 'x'+name)
for name in testfiles:
os.rename('x'+name, name)
---
reports
test_macosx.py
b'beginning 9 repetitions\r\n123456789\r\n\r\ntest_idle leaked [31, 31, 31, 31] references, sum=124\r\ntest_idle leaked [19, 21, 21, 21] memory blocks, sum=82\r\n'
test_query.py
b'beginning 9 repetitions\r\n123456789\r\n\r\ntest_idle leaked [429, 429, 429, 429] references, sum=1716\r\ntest_idle leaked [190, 192, 192, 192] memory blocks, sum=766\r\n'
There are no 'invoke event' messages.
For further testing within each file, by commenting out code, as suggested in the link above, I replaced 'testfiles' in the middle loop with ['testmacosx.py'] or ['test_query.py']. For test_macosx, the culprit is class SetupTest. For test_query, the culprit is class QueryGuiTest. Adding cls.root.update_idletasks did not solve the problem by itself (as it has in other cases). I plan to continue another time. |
|
Date |
User |
Action |
Args |
2017-06-13 05:17:26 | terry.reedy | set | recipients:
+ terry.reedy, louielu |
2017-06-13 05:17:26 | terry.reedy | set | messageid: <1497331046.43.0.660269627815.issue30642@psf.upfronthosting.co.za> |
2017-06-13 05:17:26 | terry.reedy | link | issue30642 messages |
2017-06-13 05:17:25 | terry.reedy | create | |
|