[Python-checkins] r83000 - in python/branches/release26-maint/Lib: logging/config.py test/test_logging.py
vinay.sajip
python-checkins at python.org
Tue Jul 20 22:18:15 CEST 2010
Author: vinay.sajip
Date: Tue Jul 20 22:18:14 2010
New Revision: 83000
Log:
Fixed #9310: backported logging fix from 2.7.
Modified:
python/branches/release26-maint/Lib/logging/config.py
python/branches/release26-maint/Lib/test/test_logging.py
Modified: python/branches/release26-maint/Lib/logging/config.py
==============================================================================
--- python/branches/release26-maint/Lib/logging/config.py (original)
+++ python/branches/release26-maint/Lib/logging/config.py Tue Jul 20 22:18:14 2010
@@ -104,6 +104,9 @@
def _strip_spaces(alist):
return map(lambda x: string.strip(x), 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")
@@ -214,7 +217,7 @@
#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 = []
Modified: python/branches/release26-maint/Lib/test/test_logging.py
==============================================================================
--- python/branches/release26-maint/Lib/test/test_logging.py (original)
+++ python/branches/release26-maint/Lib/test/test_logging.py Tue Jul 20 22:18:14 2010
@@ -69,6 +69,12 @@
finally:
logging._releaseLock()
+ # Set two unused loggers: one non-ASCII and one Unicode.
+ # This is to test correct operation when sorting existing
+ # loggers in the configuration code. See issues 8201, 9310.
+ logging.getLogger("\xab\xd7\xbb")
+ logging.getLogger(u"\u013f\u00d6\u0047")
+
self.root_logger = logging.getLogger("")
self.original_logging_level = self.root_logger.getEffectiveLevel()
More information about the Python-checkins
mailing list