File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -1588,7 +1588,7 @@ class capsule : public object {
15881588 }
15891589 pybind11_fail (" Unable to get capsule context" );
15901590 }
1591- void *ptr = PyCapsule_GetPointer (o, nullptr );
1591+ void *ptr = PyCapsule_GetPointer (o, PyCapsule_GetName (o) );
15921592 if (ptr == nullptr ) {
15931593 throw error_already_set ();
15941594 }
@@ -1602,7 +1602,7 @@ class capsule : public object {
16021602
16031603 explicit capsule (void (*destructor)()) {
16041604 m_ptr = PyCapsule_New (reinterpret_cast <void *>(destructor), nullptr , [](PyObject *o) {
1605- auto destructor = reinterpret_cast <void (*)()>(PyCapsule_GetPointer (o, nullptr ));
1605+ auto destructor = reinterpret_cast <void (*)()>(PyCapsule_GetPointer (o, PyCapsule_GetName (o) ));
16061606 if (destructor == nullptr ) {
16071607 throw error_already_set ();
16081608 }
@@ -1640,7 +1640,7 @@ class capsule : public object {
16401640 const char *name () const { return PyCapsule_GetName (m_ptr); }
16411641
16421642 // / Replaces a capsule's name *without* calling the destructor on the existing one.
1643- void set_name (const char * &new_name) {
1643+ void set_name (const char *&new_name) {
16441644 if (PyCapsule_SetName (m_ptr, new_name) != 0 ) {
16451645 throw error_already_set ();
16461646 }
You can’t perform that action at this time.
0 commit comments