diff options
author | scoder <none@none> | 2010-12-29 19:59:36 +0100 |
---|---|---|
committer | scoder <none@none> | 2010-12-29 19:59:36 +0100 |
commit | 0af4cf494d4ee955366f9d4b059ad1f78ef60185 (patch) | |
tree | be0e09909414bc6d7f2a79129a29bc2c0440ab63 /versioninfo.py | |
parent | 1de319553d056a18a16bea41825880e8284af2e1 (diff) | |
download | python-lxml-0af4cf494d4ee955366f9d4b059ad1f78ef60185.tar.gz |
[svn r4508] fix resource leak during build
--HG--
branch : trunk
Diffstat (limited to 'versioninfo.py')
-rw-r--r-- | versioninfo.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/versioninfo.py b/versioninfo.py index 42ce19e2..86370409 100644 --- a/versioninfo.py +++ b/versioninfo.py @@ -5,7 +5,11 @@ __LXML_VERSION = None 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(): |