diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2005-10-07 08:36:33 (GMT) |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2005-10-07 08:36:33 (GMT) |
commit | 3159fdbdb5ba12e85051431ea818d00f9a12f4b0 (patch) | |
tree | 6b10363de84e03786504261b419de46b1e18afbb /Lib | |
parent | 656b762ee8e19ce4c09da73c5dd2adaeb3818bdb (diff) | |
download | cpython-3159fdbdb5ba12e85051431ea818d00f9a12f4b0.zip cpython-3159fdbdb5ba12e85051431ea818d00f9a12f4b0.tar.gz cpython-3159fdbdb5ba12e85051431ea818d00f9a12f4b0.tar.bz2 |
Fixed bug where the logging message was wrongly being demoted from Unicode to string (SF #1314107)
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/logging/__init__.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py index 4dab918..db70293 100644 --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -41,8 +41,8 @@ except ImportError: __author__ = "Vinay Sajip <vinay_sajip@red-dove.com>" __status__ = "beta" -__version__ = "0.4.9.6" -__date__ = "27 March 2005" +__version__ = "0.4.9.7" +__date__ = "07 October 2005" #--------------------------------------------------------------------------- # Miscellaneous module data @@ -266,10 +266,12 @@ class LogRecord: if not hasattr(types, "UnicodeType"): #if no unicode support... msg = str(self.msg) else: - try: - msg = str(self.msg) - except UnicodeError: - msg = self.msg #Defer encoding till later + msg = self.msg + if type(msg) not in (types.UnicodeType, types.StringType): + try: + msg = str(self.msg) + except UnicodeError: + msg = self.msg #Defer encoding till later if self.args: msg = msg % self.args return msg |