diff options
author | Florent Xicluna <florent.xicluna@gmail.com> | 2010-09-22 22:35:38 (GMT) |
---|---|---|
committer | Florent Xicluna <florent.xicluna@gmail.com> | 2010-09-22 22:35:38 (GMT) |
commit | 42d544505fff126ba131ca20c455c3245a5687a1 (patch) | |
tree | 614162a7e49828051a956bb6a74eb246fccdac18 /Lib/configparser.py | |
parent | 31c604d3a7ed0872b0a861ce8480245ff31db37c (diff) | |
download | cpython-42d544505fff126ba131ca20c455c3245a5687a1.zip cpython-42d544505fff126ba131ca20c455c3245a5687a1.tar.gz cpython-42d544505fff126ba131ca20c455c3245a5687a1.tar.bz2 |
Fix typo and add test case.
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) |