classification
Title: Tabnanny doesn't close its tokenize files properly
Type: resource usage Stage: resolved
Components: Library (Lib) Versions: Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: anthonyb, ncoghlan
Priority: normal Keywords: patch

Created on 2011-08-22 06:07 by anthonyb, last changed 2011-08-22 08:15 by ncoghlan. This issue is now closed.

Files
File name Uploaded Description Edit
tabnanny_close_file.patch anthonyb, 2011-08-22 06:07 Patch to make tabnanny close its files properly review
Messages (2)
msg142681 - (view) Author: Anthony Briggs (anthonyb) Date: 2011-08-22 06:07
Unlike Python 2, Python 3 warns when files aren't closed properly, which raises lots of warnings when running tabnanny:

~/devinabox/cpython$ ./python -m tabnanny Lib/
/home/anthony/devinabox/cpython/Lib/tabnanny.py:93: ResourceWarning: unclosed file <_io.TextIOWrapper name='Lib/sunau.py' mode='r' encoding='utf-8'>
  check(fullname)
/home/anthony/devinabox/cpython/Lib/tabnanny.py:93: ResourceWarning: unclosed file <_io.TextIOWrapper name='Lib/sre_compile.py' mode='r' encoding='utf-8'>
  check(fullname)
/home/anthony/devinabox/cpython/Lib/tabnanny.py:93: ResourceWarning: unclosed file <_io.TextIOWrapper name='Lib/this.py' mode='r' encoding='utf-8'>
  check(fullname)
/home/anthony/devinabox/cpython/Lib/tabnanny.py:93: ResourceWarning: unclosed file <_io.TextIOWrapper name='Lib/difflib.py' mode='r' encoding='utf-8'>
  check(fullname)

The attached patch fixes the problem.
msg142683 - (view) Author: Roundup Robot (python-dev) Date: 2011-08-22 06:19
New changeset c5cb0aa5bed6 by Nick Coghlan in branch 'default':
Fix #12811 by closing files promptly in tabnanny.check. Patch by Anthony Briggs.
http://hg.python.org/cpython/rev/c5cb0aa5bed6
History
Date User Action Args
2011-08-22 08:15:08ncoghlansetstatus: open -> closed
nosy: - python-dev

resolution: fixed
stage: resolved
2011-08-22 06:19:38python-devsetnosy: + python-dev
messages: + msg142683
2011-08-22 06:07:53anthonybcreate