Skip to content

Commit

Permalink
Fix what I believe is a bug: when removing all previous handlers,
Browse files Browse the repository at this point in the history
should copy the handlers list because it's being modified by the loop.
  • Loading branch information
gvanrossum committed Dec 20, 2002
1 parent 328fff7 commit 2447589
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Lib/logging/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2447589

Please sign in to comment.