提交 ca315a08 authored 作者: Olivier Breuleux's avatar Olivier Breuleux

added PythonResult

上级 692a906b
......@@ -9,6 +9,7 @@ from utils import AbstractFunctionError
__all__ = ['ResultBase',
'PythonResult',
'StateError',
'Empty',
'Allocated',
......@@ -268,3 +269,33 @@ class ResultBase(object):
def __copy__(self):
raise AbstractFunctionError()
class PythonResult(ResultBase):
def c_declare(self):
return """
PyObject* %(name)s;
"""
def c_extract(self):
return """
Py_XINCREF(py_%(name)s);
%(name)s = py_%(name)s;
"""
def c_cleanup(self):
return """
Py_XDECREF(%(name)s);
"""
def c_sync(self):
return """
Py_XDECREF(py_%(name)s);
py_%(name)s = %(name)s;
Py_XINCREF(py_%(name)s);
"""
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论