Robert Collins added the comment:
So I'm still ambivalent at best about this - this interface hasn't been
designed for subclassing - I'm sure there is a bunch more stuff that would be
needed. What /is/ needed feature wise here is a sideways extension mechanism
for doing filtering and
Yury Selivanov added the comment:
LGTM.
FWIW, using 'self.from_exception(..)' is better because this way it's easier to
override the method. Another way would be to write
'type(self).from_exception(..)', but I think using 'self' is good enough.
--
nosy: +yselivanov
Robert Collins added the comment:
I know it 'works', I just think its not appropriate here.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24710
___
Robert Collins added the comment:
We can't use from_exception in __init__ because from_exception's job is to look
up __traceback__, but the legacy API allows arbitrary tb objects which may not
be exc.__traceback__, and modifying exc.__traceback__ or creating a shim object
just to be able to
Robert Collins added the comment:
Oh I see, - different things could have been meant but that application will
work.
But - please don't use self.from_exception: its a class method, so
TracebackException.from_exception(...) is the right spelling.
--
Changes by Serhiy Storchaka storch...@gmail.com:
--
resolution: fixed -
stage: resolved - patch review
status: closed - open
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24710
___
Serhiy Storchaka added the comment:
self.from_exception() works as well.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24710
___
___
Changes by Robert Collins robe...@robertcollins.net:
--
resolution: - fixed
stage: patch review - resolved
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24710
___
Roundup Robot added the comment:
New changeset 1be4d7388279 by Robert Collins in branch 'default':
Issue #24710: Use cls in TracebackException.from_exception.
https://hg.python.org/cpython/rev/1be4d7388279
--
nosy: +python-dev
___
Python tracker
Serhiy Storchaka added the comment:
We can use from_exception() in __init__ because in both cases first three
arguments of TracebackException() are type(e), e, e.__traceback__. Without this
change changing from_exception() makes less sense.
Here is a patch.
--
Added file:
New submission from Berker Peksag:
Here is a patch that changes to use cls() instead of hardcoded
TracebackException.
Serhiy also suggested on IRC to use the from_exception() classmethod in
TracebackException's __init__ method.
--
components: Library (Lib)
files: classmethod.diff
11 matches
Mail list logo