]> granicus.if.org Git - python/commitdiff
Issue #24710: Use cls in TracebackException.from_exception.
authorRobert Collins <rbtcollins@hp.com>
Sat, 25 Jul 2015 18:50:51 +0000 (06:50 +1200)
committerRobert Collins <rbtcollins@hp.com>
Sat, 25 Jul 2015 18:50:51 +0000 (06:50 +1200)
Minor cleanup patch from Berker Peksag.

Lib/traceback.py

index 02edeb6217ee28eb5b5f0fb63f66ab70c9062eac..3d2e5e0685c3682962dd387f805ec003415e7d9d 100644 (file)
@@ -477,10 +477,9 @@ class TracebackException:
             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."""