Commit a6c1c984 authored by Kirill Smelkov's avatar Kirill Smelkov

context: Export PyContext for cimport

For example wendelin.core wants to accept Python-level context,
transform it into C-level context and pass to pyx/nogil code.
parent 2a359791
...@@ -72,3 +72,14 @@ cdef extern from "golang/context.h" namespace "golang::context" nogil: ...@@ -72,3 +72,14 @@ cdef extern from "golang/context.h" namespace "golang::context" nogil:
# for testing # for testing
cxx.set[Context] _tctxchildren(Context ctx) cxx.set[Context] _tctxchildren(Context ctx)
# ---- python bits ----
from golang cimport pychan
from cython cimport final
@final
cdef class PyContext:
cdef Context ctx
cdef pychan _pydone # pychan wrapping ctx.done()
...@@ -48,8 +48,6 @@ cdef PyContext _newPyCtx(Context ctx): ...@@ -48,8 +48,6 @@ cdef PyContext _newPyCtx(Context ctx):
# key -> value dict. # key -> value dict.
@final @final
cdef class PyContext: cdef class PyContext:
cdef Context ctx
cdef pychan _pydone # pychan wrapping ctx.done()
def __cinit__(PyContext pyctx, object bywho): def __cinit__(PyContext pyctx, object bywho):
if bywho is not _frompyx: if bywho is not _frompyx:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment