0
0
mirror of https://github.com/python/cpython.git synced 2024-11-24 00:38:00 +01:00

Issue #24710: Use cls in TracebackException.from_exception.

Minor cleanup patch from Berker Peksag.
This commit is contained in:
Robert Collins 2015-07-26 06:50:51 +12:00
parent c94a1dc4c9
commit aece8248b6

View 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."""