summaryrefslogtreecommitdiffstats
path: root/Lib/logging/config.py
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2012-10-09 08:06:03 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2012-10-09 08:06:03 (GMT)
commitcf9e2f242081e119763f717df5fef5e6fcba8c77 (patch)
treec8a24513a6ba7450b914e7d69c55fab017a838d0 /Lib/logging/config.py
parent96df7da0acbba9e704d31436de4cb440d2df367b (diff)
downloadcpython-cf9e2f242081e119763f717df5fef5e6fcba8c77.zip
cpython-cf9e2f242081e119763f717df5fef5e6fcba8c77.tar.gz
cpython-cf9e2f242081e119763f717df5fef5e6fcba8c77.tar.bz2
Closes #16110: fileConfig now accepts a pre-initialised ConfigParser instance.
Diffstat (limited to 'Lib/logging/config.py')
-rw-r--r--Lib/logging/config.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/Lib/logging/config.py b/Lib/logging/config.py
index 9ba3cca..0694d21 100644
--- a/Lib/logging/config.py
+++ b/Lib/logging/config.py
@@ -61,11 +61,14 @@ def fileConfig(fname, defaults=None, disable_existing_loggers=True):
"""
import configparser
- cp = configparser.ConfigParser(defaults)
- if hasattr(fname, 'readline'):
- cp.read_file(fname)
+ if isinstance(fname, configparser.RawConfigParser):
+ cp = fname
else:
- cp.read(fname)
+ cp = configparser.ConfigParser(defaults)
+ if hasattr(fname, 'readline'):
+ cp.read_file(fname)
+ else:
+ cp.read(fname)
formatters = _create_formatters(cp)