[pypy-commit] pypy py3.6: oops sorry. Test and fix
arigo
pypy.commits at gmail.com
Fri Nov 8 02:18:15 EST 2019
Author: Armin Rigo <arigo at tunes.org>
Branch: py3.6
Changeset: r97992:a0ad758e734a
Date: 2019-11-08 08:17 +0100
http://bitbucket.org/pypy/pypy/changeset/a0ad758e734a/
Log: oops sorry. Test and fix
diff --git a/pypy/interpreter/executioncontext.py b/pypy/interpreter/executioncontext.py
--- a/pypy/interpreter/executioncontext.py
+++ b/pypy/interpreter/executioncontext.py
@@ -262,6 +262,8 @@
self.sys_exc_operror = operror
def set_sys_exc_info3(self, w_type, w_value, w_traceback):
+ from pypy.interpreter import pytraceback
+
space = self.space
if space.is_none(w_value):
operror = None
diff --git a/pypy/module/__pypy__/test/test_magic.py b/pypy/module/__pypy__/test/test_magic.py
--- a/pypy/module/__pypy__/test/test_magic.py
+++ b/pypy/module/__pypy__/test/test_magic.py
@@ -77,3 +77,18 @@
except RuntimeError as e:
assert e.__cause__ is None
assert e.__context__ is None
+
+ def test_set_exc_info_traceback(self):
+ import sys
+ from __pypy__ import set_exc_info
+ def f():
+ 1 // 0
+ def g():
+ try:
+ f()
+ except ZeroDivisionError:
+ return sys.exc_info()[2]
+ tb = g()
+ terr = TypeError("hello world")
+ set_exc_info(TypeError, terr, tb)
+ assert sys.exc_info()[2] is tb
diff --git a/pypy/module/cpyext/pyerrors.py b/pypy/module/cpyext/pyerrors.py
--- a/pypy/module/cpyext/pyerrors.py
+++ b/pypy/module/cpyext/pyerrors.py
@@ -2,7 +2,6 @@
from rpython.rtyper.lltypesystem import rffi, lltype
from pypy.interpreter.error import OperationError, oefmt, strerror as _strerror
-from pypy.interpreter import pytraceback
from pypy.module.cpyext.api import cpython_api, CANNOT_FAIL, CONST_STRING
from pypy.module.cpyext.api import PyObjectFields, cpython_struct
from pypy.module.cpyext.api import bootstrap_function, slot_function
More information about the pypy-commit
mailing list