Author: Armin Rigo <[email protected]>
Branch: py3.5
Changeset: r88480:6664bdccb98b
Date: 2016-11-19 17:57 +0100
http://bitbucket.org/pypy/pypy/changeset/6664bdccb98b/

Log:    Fix sys.exc_info in _continuation: we now need to save and restore
        it carefully

diff --git a/pypy/module/_continuation/interp_continuation.py 
b/pypy/module/_continuation/interp_continuation.py
--- a/pypy/module/_continuation/interp_continuation.py
+++ b/pypy/module/_continuation/interp_continuation.py
@@ -42,6 +42,7 @@
         bottomframe.locals_cells_stack_w[3] = w_kwds
         bottomframe.last_exception = get_cleared_operation_error(space)
         self.bottomframe = bottomframe
+        self.saved_exception = None
         #
         global_state.origin = self
         self.sthread = sthread
@@ -227,6 +228,8 @@
 def new_stacklet_callback(h, arg):
     self = global_state.origin
     self.h = h
+    self.saved_exception = self.sthread.ec.sys_exc_info()
+    self.sthread.ec.set_sys_exc_info(None)
     global_state.clear()
     try:
         frame = self.bottomframe
@@ -248,9 +251,12 @@
     self.h, origin.h = origin.h, h
     #
     current = sthread.ec.topframeref
+    saved_exc = sthread.ec.sys_exc_info()
     sthread.ec.topframeref = self.bottomframe.f_backref
+    sthread.ec.set_sys_exc_info(self.saved_exception)
     self.bottomframe.f_backref = origin.bottomframe.f_backref
     origin.bottomframe.f_backref = current
+    origin.saved_exception = saved_exc
     #
     return get_result()
 
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to