[Python-checkins] r85943 - python/branches/py3k/Lib/pkgutil.py

brett.cannon python-checkins at python.org
Sat Oct 30 00:36:53 CEST 2010


Author: brett.cannon
Date: Sat Oct 30 00:36:53 2010
New Revision: 85943
Log:
Have pkgutil properly close files.
Modified:
 python/branches/py3k/Lib/pkgutil.py
Modified: python/branches/py3k/Lib/pkgutil.py
==============================================================================
--- python/branches/py3k/Lib/pkgutil.py	(original)
+++ python/branches/py3k/Lib/pkgutil.py	Sat Oct 30 00:36:53 2010
@@ -241,7 +241,8 @@
 return mod
 
 def get_data(self, pathname):
- return open(pathname, "rb").read()
+ with open(pathname, "rb") as file:
+ return file.read()
 
 def _reopen(self):
 if self.file and self.file.closed:


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /