Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions include/pybind11/detail/type_caster_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class loader_life_support {
}
frame = parent;
for (auto *item : keep_alive) {
Py_DECREF(item);
Py_DECREF(item); // decref in C++ dtor: always safe?
}
}

Expand Down Expand Up @@ -727,7 +727,7 @@ struct shared_ptr_parent_life_support {
// NOLINTNEXTLINE(readability-make-member-function-const)
void operator()(void *) {
gil_scoped_acquire gil;
Py_DECREF(parent);
Py_DECREF(parent); // decref in C++ dtor: NEEDS can_decref_now
}
};

Expand All @@ -741,7 +741,7 @@ struct shared_ptr_trampoline_self_life_support {
// NOLINTNEXTLINE(readability-make-member-function-const)
void operator()(void *) {
gil_scoped_acquire gil;
Py_DECREF(self);
Py_DECREF(self); // decref in C++ dtor: NEEDS can_decref_now
}
};

Expand Down
4 changes: 3 additions & 1 deletion include/pybind11/trampoline_self_life_support.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ struct trampoline_self_life_support {
v_h.value_ptr() = nullptr;
v_h.holder<smart_holder>().release_disowned();
detail::deregister_instance(v_h.inst, value_void_ptr, v_h.type);
Py_DECREF((PyObject *) v_h.inst); // Must be after deregister.
Py_DECREF(
(PyObject *)
v_h.inst); // Must be after deregister. // decref in C++ dtor: always safe?
PyGILState_Release(threadstate);
}
}
Expand Down