Permalink
Browse files

[svn r4508] fix resource leak during build

--HG--
branch : trunk
  • Loading branch information...
1 parent 1de3195 commit 0af4cf494d4ee955366f9d4b059ad1f78ef60185 scoder committed Dec 29, 2010
Showing with 5 additions and 1 deletion.
  1. +5 −1 versioninfo.py
View
@@ -5,7 +5,11 @@
def version():
global __LXML_VERSION
if __LXML_VERSION is None:
- __LXML_VERSION = open(os.path.join(get_base_dir(), 'version.txt')).read().strip()
+ f = open(os.path.join(get_base_dir(), 'version.txt'))
+ try:
+ __LXML_VERSION = f.read().strip()
+ finally:
+ f.close()
return __LXML_VERSION
def branch_version():

0 comments on commit 0af4cf4

Please sign in to comment.