Fix typo and add test case.
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 @@
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 @@
"""
if source is None:
try:
- srouce = f.name
+ source = f.name
except AttributeError:
source = '<???>'
self._read(f, source)