diff options
author | Georg Brandl <georg@python.org> | 2008-01-16 20:27:25 +0000 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2008-01-16 20:27:25 +0000 |
commit | b09e628b0f33614e81521ad60e94472a0db09a4d (patch) | |
tree | 9fde04d85255a2f7569f8f10def1f2cfe70f303e /sphinx/refcounting.py | |
parent | 1fbdc410b71ab6515ad576ef277700b9dba92d47 (diff) | |
download | sphinx-git-b09e628b0f33614e81521ad60e94472a0db09a4d.tar.gz |
A few refactorings in Sphinx.
Diffstat (limited to 'sphinx/refcounting.py')
-rw-r--r-- | sphinx/refcounting.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sphinx/refcounting.py b/sphinx/refcounting.py index c1b5f7c05..d57b6193b 100644 --- a/sphinx/refcounting.py +++ b/sphinx/refcounting.py @@ -9,8 +9,6 @@ :copyright: 2007-2008 by Georg Brandl. :license: BSD. """ -from __future__ import with_statement - class RCEntry: def __init__(self, name): @@ -24,7 +22,8 @@ class Refcounts(dict): @classmethod def fromfile(cls, filename): d = cls() - with open(filename, 'r') as fp: + fp = open(filename, 'r') + try: for line in fp: line = line.strip() if line[:1] in ("", "#"): @@ -49,4 +48,6 @@ class Refcounts(dict): else: entry.result_type = type entry.result_refs = refcount + finally: + fp.close() return d |