File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -1011,7 +1011,14 @@ class capsule : public object {
10111011 pybind11_fail (" Could not allocate capsule object!" );
10121012 }
10131013
1014- explicit capsule (const void *value, void (*destructor)(void *)) {
1014+ PYBIND11_DEPRECATED (" Please pass a destructor that takes a void pointer as input" )
1015+ capsule (const void *value, void (*destruct)(PyObject *))
1016+ : object(PyCapsule_New(const_cast <void *>(value), nullptr , destruct), stolen) {
1017+ if (!m_ptr)
1018+ pybind11_fail (" Could not allocate capsule object!" );
1019+ }
1020+
1021+ capsule (const void *value, void (*destructor)(void *)) {
10151022 m_ptr = PyCapsule_New (const_cast <void *>(value), nullptr , [](PyObject *o) {
10161023 auto destructor = reinterpret_cast <void (*)(void *)>(PyCapsule_GetContext (o));
10171024 void *ptr = PyCapsule_GetPointer (o, nullptr );
You can’t perform that action at this time.
0 commit comments