folly:fibers  (https://github.com/facebook/folly/tree/master/folly/fibers ) is 
a C++ package for lightweight, cooperatively scheduled threads.  We have an 
application which extends this to CPython by adding the following save/restore 
code around task function invocation:

      auto tstate = PyThreadState_Get();
      CHECK_NOTNULL(tstate);
      auto savedFrame = tstate->frame;
      auto savedExcType = tstate->exc_type;
      auto savedExcValue = tstate->exc_value;
      auto savedExcTraceback = tstate->exc_traceback;
      func();
      tstate->frame = savedFrame;
      tstate->exc_type = savedExcType;
      tstate->exc_value = savedExcValue;
      tstate->exc_traceback = savedExcTraceback;

(here func is a boost::python::object)

This does not work in PyPy 5.9 immediately because the thread state object does 
not expose these fields nor are there accessor methods.

Is there a way to get similar effect in PyPy?

Thanks
david




_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
https://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to