From 02f69183d1706f7924f35de60dc9f94c47452398 Mon Sep 17 00:00:00 2001 From: Matthias Diener Date: Fri, 4 Oct 2024 21:50:11 -0500 Subject: [PATCH] slots for Image, SVM --- src/wrap_cl_part_2.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/wrap_cl_part_2.cpp b/src/wrap_cl_part_2.cpp index 2b4689e8..278a11bb 100644 --- a/src/wrap_cl_part_2.cpp +++ b/src/wrap_cl_part_2.cpp @@ -32,7 +32,11 @@ -void *dummy_fn() {} +void dummy_fn() {} +PyType_Slot slots[] = { + {Py_tp_init, (void*) dummy_fn}, + { 0, nullptr } + }; namespace pyopencl { #if PYOPENCL_CL_VERSION >= 0x1020 @@ -100,7 +104,7 @@ void pyopencl_expose_part_2(py::module_ &m) { typedef image cls; - py::class_(m, "Image", py::dynamic_attr()) + py::class_(m, "Image", py::dynamic_attr(), py::type_slots(slots)) .def( "__init__", []( @@ -348,7 +352,7 @@ void pyopencl_expose_part_2(py::module_ &m) { typedef svm_arg_wrapper cls; - py::class_(m, "SVM", py::dynamic_attr()) + py::class_(m, "SVM", py::dynamic_attr(), py::type_slots(slots)) .def(py::init()) ; } @@ -536,11 +540,6 @@ void pyopencl_expose_part_2(py::module_ &m) // {{{ kernel - PyType_Slot slots[] = { - {Py_tp_init, (void*) dummy_fn}, - { 0, nullptr } - }; - { typedef kernel cls; py::class_(m, "Kernel", py::dynamic_attr(), py::type_slots(slots))