Author: Antonio Cuni <anto.c...@gmail.com> Branch: py3k Changeset: r52501:145994f7f8f9 Date: 2012-02-15 11:14 +0100 http://bitbucket.org/pypy/pypy/changeset/145994f7f8f9/
Log: implement support for __traceback__ when raising exceptions. test_raise fully passes now :-) diff --git a/pypy/interpreter/pyopcode.py b/pypy/interpreter/pyopcode.py --- a/pypy/interpreter/pyopcode.py +++ b/pypy/interpreter/pyopcode.py @@ -495,8 +495,17 @@ w_type = space.type(w_value) operror = OperationError(w_type, w_value, w_cause=w_cause) operror.normalize_exception(space) + # XXX: we actually know that w_value is an instance of + # W_BaseException, so we could directly use w_value.w_traceback, + # however that class belongs to the std objspace, so for now we just + # go through all the getattr machinery (which is removed by the JIT + # anyway) + tb = space.getattr(w_value, space.wrap('__traceback__')) + if tb is not None: + operror.set_traceback(tb) raise operror + def LOAD_LOCALS(self, oparg, next_instr): self.pushvalue(self.w_locals) _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit