Review Request: use context manager for file open

Ralf Habacker ralf at habacker.de
Tue Feb 15 15:57:11 CET 2011


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

Ship it!


good catch, this is very useful :-)


- Ralf


On Feb. 15, 2011, 8:12 a.m., Wolfgang Rohdewald wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://svn.reviewboard.kde.org/r/6484/
> -----------------------------------------------------------
> 
> (Updated Feb. 15, 2011, 8:12 a.m.)
> 
> 
> 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/239abe2a/attachment.htm 


More information about the Kde-windows mailing list