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 {
1588
1588
}
1589
1589
pybind11_fail (" Unable to get capsule context" );
1590
1590
}
1591
- void *ptr = PyCapsule_GetPointer (o, nullptr );
1591
+ void *ptr = PyCapsule_GetPointer (o, PyCapsule_GetName (o) );
1592
1592
if (ptr == nullptr ) {
1593
1593
throw error_already_set ();
1594
1594
}
@@ -1602,7 +1602,7 @@ class capsule : public object {
1602
1602
1603
1603
explicit capsule (void (*destructor)()) {
1604
1604
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) ));
1606
1606
if (destructor == nullptr ) {
1607
1607
throw error_already_set ();
1608
1608
}
@@ -1640,7 +1640,7 @@ class capsule : public object {
1640
1640
const char *name () const { return PyCapsule_GetName (m_ptr); }
1641
1641
1642
1642
// / 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) {
1644
1644
if (PyCapsule_SetName (m_ptr, new_name) != 0 ) {
1645
1645
throw error_already_set ();
1646
1646
}
You can’t perform that action at this time.
0 commit comments