summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2002-12-20 01:54:21 (GMT)
committerGuido van Rossum <guido@python.org>2002-12-20 01:54:21 (GMT)
commit24475896dd7c80695cb1b632fba37afd99d3b71b (patch)
treed7cac0d43c0669965c86656ebf1e64f64eaf140b
parent328fff72149a896141209b57b577b4dc57ea5d90 (diff)
downloadcpython-24475896dd7c80695cb1b632fba37afd99d3b71b.zip
cpython-24475896dd7c80695cb1b632fba37afd99d3b71b.tar.gz
cpython-24475896dd7c80695cb1b632fba37afd99d3b71b.tar.bz2
Fix what I believe is a bug: when removing all previous handlers,
should copy the handlers list because it's being modified by the loop.
-rw-r--r--Lib/logging/config.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/logging/config.py b/Lib/logging/config.py
index 3d342f4..933bdc7 100644
--- a/Lib/logging/config.py
+++ b/Lib/logging/config.py
@@ -133,7 +133,7 @@ def fileConfig(fname, defaults=None):
if "level" in opts:
level = cp.get(sectname, "level")
log.setLevel(logging._levelNames[level])
- for h in root.handlers:
+ for h in root.handlers[:]:
root.removeHandler(h)
hlist = cp.get(sectname, "handlers")
if len(hlist):
@@ -165,7 +165,7 @@ def fileConfig(fname, defaults=None):
if "level" in opts:
level = cp.get(sectname, "level")
logger.setLevel(logging._levelNames[level])
- for h in logger.handlers:
+ for h in logger.handlers[:]:
logger.removeHandler(h)
logger.propagate = propagate
logger.disabled = 0