Review Request: use context manager for file open

Wolfgang Rohdewald wolfgang at rohdewald.de
Tue Feb 15 09:12:15 CET 2011


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://svn.reviewboard.kde.org/r/6484/
-----------------------------------------------------------

Review request for kde-windows.


Summary
-------

Python 2.7 allows to use open() as a context manager. This makes code simpler and ensures that files are always closed.

In some places emerge actually did not close files, even after writing to them. It is then depending on the python implementation if and when they are automatically written and closed - there is no guarantee they ever will.

I did not (yet) change emerge/portage, only emerge/bin


Diffs
-----

  /trunk/kdesupport/emerge/bin/BuildSystem/BuildSystemBase.py 1220833 
  /trunk/kdesupport/emerge/bin/BuildSystem/CMakeBuildSystem.py 1220833 
  /trunk/kdesupport/emerge/bin/BuildSystem/CMakeDependencies.py 1220833 
  /trunk/kdesupport/emerge/bin/InstallDB.py 1220833 
  /trunk/kdesupport/emerge/bin/Packager/InnoSetupPackager.py 1220833 
  /trunk/kdesupport/emerge/bin/Packager/PackagerBase.py 1220833 
  /trunk/kdesupport/emerge/bin/Source/HgSource.py 1220833 
  /trunk/kdesupport/emerge/bin/Source/SvnSource.py 1220833 
  /trunk/kdesupport/emerge/bin/options.py 1220833 
  /trunk/kdesupport/emerge/bin/package_definition_viewer.py 1220833 
  /trunk/kdesupport/emerge/bin/portage.py 1220833 
  /trunk/kdesupport/emerge/bin/tools.py 1220833 
  /trunk/kdesupport/emerge/bin/update.py 1220833 
  /trunk/kdesupport/emerge/bin/utils.py 1220833 
  /trunk/kdesupport/emerge/bin/xml2conf.py 1220833 

Diff: http://svn.reviewboard.kde.org/r/6484/diff


Testing
-------


Thanks,

Wolfgang

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/kde-windows/attachments/20110215/cebe54a3/attachment.htm 


More information about the Kde-windows mailing list