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.

Author arkady.koplyarov
Recipients arkady.koplyarov, brian.curtin, ncoghlan
Date 2011-03-16.22:46:37
SpamBayes Score 0.00041380708
Marked as misclassified No
Message-id <1300315599.81.0.59305176228.issue11577@psf.upfronthosting.co.za>
In-reply-to
Content
The testcase provided shows up a resource leakage:
-----
C:\_cpython\cpython>PCbuild\python_d.exe  -m test.regrtest test_binhex
[1/1] test_binhex
C:\_cpython\cpython\lib\unittest\case.py:574: ResourceWarning: unclosed file <_io.BufferedWriter name='@test_5592_tmp2'>
  callableObj(*args, **kwargs)
1 test OK.
-----
The resource leakage occurs in module binhex.py in binhex(inp,out) > BinHex.__init__() > _writeinfo() when the exception binhex.Error is raised in _writeinfo() at the code line:
    raise Error('Filename too long')
The issue is that when the exception is thrown the file is left unclosed.

One of possible fixes is to catch the thrown exception and close the unclosed file in the BinHex.__init__().
History
Date User Action Args
2011-03-16 22:46:39arkady.koplyarovsetrecipients: + arkady.koplyarov, ncoghlan, brian.curtin
2011-03-16 22:46:39arkady.koplyarovsetmessageid: <1300315599.81.0.59305176228.issue11577@psf.upfronthosting.co.za>
2011-03-16 22:46:37arkady.koplyarovlinkissue11577 messages
2011-03-16 22:46:37arkady.koplyarovcreate