[issue30642] Fix leaks in idlelib

2017-08-07 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Unlinked old findleak.py after uploading much improved version to #31130.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30642] Fix leaks in idlelib

2017-08-07 Thread Terry J. Reedy

Changes by Terry J. Reedy :


Removed file: http://bugs.python.org/file46948/findleak.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30642] Fix leaks in idlelib

2017-06-15 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
resolution:  -> fixed
stage: needs patch -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30642] Fix leaks in idlelib

2017-06-13 Thread Terry J. Reedy

Terry J. Reedy added the comment:

f:\dev\36>python -m test -R: -ugui test_idle
gives about 40 invoke event messages, but the test passes.  So the messages and 
leaks are not connected.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30642] Fix leaks in idlelib

2017-06-13 Thread Terry J. Reedy

Terry J. Reedy added the comment:


New changeset b0efd493b6af24a6ae744e7e02f4b69c70e88f3d by terryjreedy in branch 
'3.6':
[3.6]bpo-30642: Fix ref leak in idle_test.test_macosx (#2163) (#2165)
https://github.com/python/cpython/commit/b0efd493b6af24a6ae744e7e02f4b69c70e88f3d


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30642] Fix leaks in idlelib

2017-06-13 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
pull_requests: +2216

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30642] Fix leaks in idlelib

2017-06-13 Thread Terry J. Reedy

Terry J. Reedy added the comment:

The macosx leak came from repeated calls to
root.createcommand("::tk::mac::OpenDocument", doOpenFile)
in macosx.addOpenEventSupport(root, flist), which is called from 
macosx.setupApp, which is called in test_macosx.SetupTest.test_setupapp.

Attached is an improved version of findleak.py, which made it easy to isolate 
one test file by renaming, repeatedly determine whether the leak remained after 
modifying either macosx.py or test_macosx.py, and revert all the other names 
when done.

--
Added file: http://bugs.python.org/file46948/findleak.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30642] Fix leaks in idlelib

2017-06-13 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
pull_requests: +2214

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30642] Fix leaks in idlelib

2017-06-13 Thread Terry J. Reedy

Terry J. Reedy added the comment:


New changeset 2bfb45d447c445b3c3afc19d16b4cd4773975993 by terryjreedy in branch 
'3.6':
bpo-30642: IDLE: Fix test_query refleak (#2147) (#2161)
https://github.com/python/cpython/commit/2bfb45d447c445b3c3afc19d16b4cd4773975993


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30642] Fix leaks in idlelib

2017-06-13 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
pull_requests: +2212

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30642] Fix leaks in idlelib

2017-06-13 Thread Terry J. Reedy

Terry J. Reedy added the comment:


New changeset b070fd275b68df5c5ba9f6f43197b8d7066f0b18 by terryjreedy 
(mlouielu) in branch 'master':
bpo-30642: IDLE: Fix test_query refleak (#2147)
https://github.com/python/cpython/commit/b070fd275b68df5c5ba9f6f43197b8d7066f0b18


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30642] Fix leaks in idlelib

2017-06-12 Thread Louie Lu

Louie Lu added the comment:

test_query were fixed in PR 2147, which is leak by not removing mock.Mock() in 
dialog.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30642] Fix leaks in idlelib

2017-06-12 Thread Louie Lu

Changes by Louie Lu :


--
pull_requests: +2197

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30642] Fix leaks in idlelib

2017-06-12 Thread Terry J. Reedy

New submission from Terry J. Reedy:

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 <>"
(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.

--
assignee: terry.reedy
components: IDLE
messages: 295846
nosy: louielu, terry.reedy
priority: normal
severity: normal
stage: needs patch
status: open
title: Fix leaks in idlelib
type: behavior
versions: Python 3.6, Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com