Hi David.

You're probably completely aware that such calls (using cpyext) would
completely kill performance, right? I didn't look in detail, but in
order to get performance, you would need to write such calls using
cffi.

Best regards,
Maciej Fijalkowski

On Mon, Oct 16, 2017 at 7:18 PM, David Callahan <dcalla...@fb.com> wrote:
> 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
>
_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
https://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to