Arkady Koplyarov <akoplya...@rim.com> added the comment:

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__().

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue11577>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to