cpython (2.7): Closes #25664: handled logger names in Unicode.
https://hg.python.org/cpython/rev/512a628c683e changeset: 99678:512a628c683e branch: 2.7 parent: 99671:deda5b5160d2 user: Vinay Sajip <vinay_sajip@yahoo.co.uk> date: Sat Dec 26 12:21:47 2015 +0000 summary: Closes #25664: handled logger names in Unicode. files: Lib/logging/__init__.py | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -465,7 +465,15 @@ record.message = record.getMessage() if self.usesTime(): record.asctime = self.formatTime(record, self.datefmt) - s = self._fmt % record.__dict__ + try: + s = self._fmt % record.__dict__ + except UnicodeDecodeError as e: + # Issue 25664. The logger name may be Unicode. Try again ... + try: + record.name = record.name.decode('utf-8') + s = self._fmt % record.__dict__ + except UnicodeDecodeError: + raise e if record.exc_info: # Cache the traceback text to avoid converting it multiple times # (it's constant anyway) -- Repository URL: https://hg.python.org/cpython
participants (1)
-
vinay.sajip