Arkady Koplyarov added the comment:
Well, I believe that in BinHex.__init__() I cannot just wrap the _writeinfo
call into a try-finally block, and close ofp in the finally.
I see that in the case of normal operation when the exception is not thrown,
the output file descriptor ofp is used in
Arkady Koplyarov 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.BufferedWrite
Arkady Koplyarov added the comment:
The testcase updated accordingly to Nick Coghlan's suggestion to use
assertRaises() since the testcase deals with an exception.
--
Added file: http://bugs.python.org/file21252/testcase_for_binhex_module_2.
New submission from Arkady Koplyarov :
Testcase for exception binhex.Error to increase test coverage.
--
components: Library (Lib), Tests
files: testcase_for_binhex_module.patch
keywords: patch
messages: 131159
nosy: arkady.koplyarov
priority: normal
severity: normal
status: open
title