Changes by Serhiy Storchaka storch...@gmail.com:
--
resolution: - fixed
stage: commit review - resolved
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22826
___
Roundup Robot added the comment:
New changeset ea8c3166d1c2 by Serhiy Storchaka in branch 'default':
Issue #22826: The result of open() in Tools/freeze/bkfile.py is now better
https://hg.python.org/cpython/rev/ea8c3166d1c2
--
nosy: +python-dev
___
Changes by Berker Peksag berker.pek...@gmail.com:
--
assignee: - serhiy.storchaka
stage: patch review - commit review
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22826
___
Changes by Serhiy Storchaka storch...@gmail.com:
--
keywords: +needs review
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22826
___
___
Berker Peksag added the comment:
The second patch raises RuntimeError: maximum recursion depth exceeded if the
target file is exist.
File /home/berker/projects/cpython/default/Tools/freeze/bkfile.py, line
18, in close
f.close()
RuntimeError: maximum recursion depth exceeded
Serhiy Storchaka added the comment:
Good catch Berker. Updated patch fixes recursion issue.
--
Added file: http://bugs.python.org/file37456/bkfile3.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22826
New submission from Serhiy Storchaka:
Proposed patch makes bkfile (file-like class used in freeze) support the
context management protocol. This makes bkfile more file-like and makes the use
of it simpler and more robust.
--
components: Demos and Tools
files: bkfile.diff
keywords:
Raymond Hettinger added the comment:
This looks correct and it improves readability.
One nit, please put the doubled with on a single line instead of using the
awkward line break (which looks weird with respect to the indentation of the
with-block):
+with open(config_c_in) as infp,
Serhiy Storchaka added the comment:
Thank you Raymond. I found my old patch written 5 months ago. It drastically
simplifies bkfile by using monkey-patching. What approach looks better to you?
--
Added file: http://bugs.python.org/file37157/bkfile2.patch