[Python-checkins] cpython: Issue #24710: Use cls in TracebackException.from_exception.

robert.collins python-checkins at python.org
Sat Jul 25 20:51:10 CEST 2015


https://hg.python.org/cpython/rev/1be4d7388279
changeset:   97067:1be4d7388279
user:        Robert Collins <rbtcollins at hp.com>
date:        Sun Jul 26 06:50:51 2015 +1200
summary:
  Issue #24710: Use cls in TracebackException.from_exception.

Minor cleanup patch from Berker Peksag.

files:
  Lib/traceback.py |  5 ++---
  1 files changed, 2 insertions(+), 3 deletions(-)


diff --git a/Lib/traceback.py b/Lib/traceback.py
--- a/Lib/traceback.py
+++ b/Lib/traceback.py
@@ -477,10 +477,9 @@
             self._load_lines()
 
     @classmethod
-    def from_exception(self, exc, *args, **kwargs):
+    def from_exception(cls, exc, *args, **kwargs):
         """Create a TracebackException from an exception."""
-        return TracebackException(
-            type(exc), exc, exc.__traceback__, *args, **kwargs)
+        return cls(type(exc), exc, exc.__traceback__, *args, **kwargs)
 
     def _load_lines(self):
         """Private API. force all lines in the stack to be loaded."""

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


More information about the Python-checkins mailing list