summaryrefslogtreecommitdiffstats
path: root/Lib/logging
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2010-03-22 13:02:28 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2010-03-22 13:02:28 (GMT)
commit31e928eb3c44d90ec951db118de4736e90532f84 (patch)
tree9e27ac1606393b850688c0a022643ba1a06c5c10 /Lib/logging
parentc7790ed1637ad688ea61decf45703f996f29584d (diff)
downloadcpython-31e928eb3c44d90ec951db118de4736e90532f84.zip
cpython-31e928eb3c44d90ec951db118de4736e90532f84.tar.gz
cpython-31e928eb3c44d90ec951db118de4736e90532f84.tar.bz2
Issue #8201: logging: Handle config errors when non-ASCII and Unicode logger names exist at the same time.
Diffstat (limited to 'Lib/logging')
-rw-r--r--Lib/logging/config.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/logging/config.py b/Lib/logging/config.py
index 21e10c1..4f55c53 100644
--- a/Lib/logging/config.py
+++ b/Lib/logging/config.py
@@ -98,6 +98,9 @@ def _resolve(name):
def _strip_spaces(alist):
return map(lambda x: x.strip(), alist)
+def _encoded(s):
+ return s if isinstance(s, str) else s.encode('utf-8')
+
def _create_formatters(cp):
"""Create and return formatters"""
flist = cp.get("formatters", "keys")
@@ -208,7 +211,7 @@ def _install_loggers(cp, handlers, disable_existing_loggers):
#avoid disabling child loggers of explicitly
#named loggers. With a sorted list it is easier
#to find the child loggers.
- existing.sort()
+ existing.sort(key=_encoded)
#We'll keep the list of existing loggers
#which are children of named loggers here...
child_loggers = []
@@ -580,7 +583,7 @@ class DictConfigurator(BaseConfigurator):
#avoid disabling child loggers of explicitly
#named loggers. With a sorted list it is easier
#to find the child loggers.
- existing.sort()
+ existing.sort(key=_encoded)
#We'll keep the list of existing loggers
#which are children of named loggers here...
child_loggers = []