[Python-checkins] cpython (2.7): Issue #15541: Correct anomaly in logging.exception. Thanks to Ned Batchelder

vinay.sajip python-checkins at python.org
Sun Aug 5 00:43:32 CEST 2012


http://hg.python.org/cpython/rev/322da186cced
changeset:   78424:322da186cced
branch:      2.7
parent:      78417:44c00de723b3
user:        Vinay Sajip <vinay_sajip at yahoo.co.uk>
date:        Sat Aug 04 23:40:21 2012 +0100
summary:
  Issue #15541: Correct anomaly in logging.exception. Thanks to Ned Batchelder for the report.

files:
  Lib/logging/__init__.py |  10 ++++++----
  1 files changed, 6 insertions(+), 4 deletions(-)


diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
--- a/Lib/logging/__init__.py
+++ b/Lib/logging/__init__.py
@@ -1173,11 +1173,12 @@
         if self.isEnabledFor(ERROR):
             self._log(ERROR, msg, args, **kwargs)
 
-    def exception(self, msg, *args):
+    def exception(self, msg, *args, **kwargs):
         """
         Convenience method for logging an ERROR with exception information.
         """
-        self.error(msg, exc_info=1, *args)
+        kwargs['exc_info'] = 1
+        self.error(msg, *args, **kwargs)
 
     def critical(self, msg, *args, **kwargs):
         """
@@ -1582,12 +1583,13 @@
         basicConfig()
     root.error(msg, *args, **kwargs)
 
-def exception(msg, *args):
+def exception(msg, *args, **kwargs):
     """
     Log a message with severity 'ERROR' on the root logger,
     with exception information.
     """
-    error(msg, exc_info=1, *args)
+    kwargs['exc_info'] = 1
+    error(msg, *args, **kwargs)
 
 def warning(msg, *args, **kwargs):
     """

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list