New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix leaks in idlelib #74827
Comments
When Louie Lu posted a link to Error output is about 20 copies of the following: At the end: 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 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. |
test_query were fixed in PR 2147, which is leak by not removing mock.Mock() in dialog. |
The macosx leak came from repeated calls to 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. |
f:\dev\36>python -m test -R: -ugui test_idle |
Unlinked old findleak.py after uploading much improved version to bpo-31130. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: