From d288461154bf6b8b33234af780a2c28aa80f955b Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner <inform@tiker.net> Date: Wed, 8 Aug 2018 09:21:02 -0500 Subject: [PATCH] [pybind] Use lambda for custom contxt constructor [ci skip] --- src/wrap_cl_part_1.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/wrap_cl_part_1.cpp b/src/wrap_cl_part_1.cpp index a4a82a5f..cffe95d4 100644 --- a/src/wrap_cl_part_1.cpp +++ b/src/wrap_cl_part_1.cpp @@ -51,15 +51,22 @@ void pyopencl_expose_part_1(py::module &m) { typedef context cls; py::class_<cls, std::shared_ptr<cls>>(m, "Context") -#if 0 .def( - py::init(create_context)/*, + py::init( + [](py::object py_devices, py::object py_properties, + py::object py_dev_type) + { + PYOPENCL_RETRY_RETURN_IF_MEM_ERROR( + return create_context_inner( + py_devices, + py_properties, + py_dev_type); + ) + }), py::arg("devices")=py::object(), py::arg("properties")=py::object(), py::arg("dev_type")=py::object() - */ ) -#endif .DEF_SIMPLE_METHOD(get_info) .def(py::self == py::self) .def(py::self != py::self) -- GitLab