Closed svisser closed 10 years ago
Thanks! Is it a cleanup, or you have a practical issue with open(..).read()
? File handles are closed when setup.py exits; usually this happens soon.
@kmike actually, if execution is stopped before setup.py
finishes (interruption via keyboard, process killed or some other reason) then I'm not sure whether the file handles are properly closed. This change ensures the risk of not closing a file is reduced.
Handles are closed by OS in this case. Python-level close() method may remain uncalled; this could be an issue if we write to files (because it could cause a buffer not to be flushed), but for reading it is not a problem.
I'm fine with merging it if you change the code to use context managers.
Ah, they were introduced in Python 2.5 - somehow I thought they were introduced in Python 2.6.
The above commit changes the code to use context managers.
Thanks!
This change ensures the file handles are closed properly in setup.py.