diff options
Diffstat (limited to 'Lib/configparser.py')
-rw-r--r-- | Lib/configparser.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Lib/configparser.py b/Lib/configparser.py index 7f1514f..03d6713 100644 --- a/Lib/configparser.py +++ b/Lib/configparser.py @@ -493,11 +493,10 @@ class RawConfigParser: read_ok = [] for filename in filenames: try: - fp = open(filename, encoding=encoding) + with open(filename, encoding=encoding) as fp: + self._read(fp, filename) except IOError: continue - self._read(fp, filename) - fp.close() read_ok.append(filename) return read_ok @@ -511,7 +510,7 @@ class RawConfigParser: """ if source is None: try: - srouce = f.name + source = f.name except AttributeError: source = '<???>' self._read(f, source) |