Skip to content

Commit cd950dc

Browse files
committed
Fix unique_ptr::reset -> unique_ptr::release
1 parent 7daecd7 commit cd950dc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

include/pybind11/gil_safe_call_once.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -279,16 +279,16 @@ class gil_safe_call_once_and_store {
279279
// At this point, the capsule object is created successfully.
280280
// Release the unique_ptr and let the capsule object own the storage to avoid
281281
// double-free.
282-
storage_ptr.reset();
282+
(void) storage_ptr.release();
283283

284284
// Use `PyDict_SetDefault` for atomic test-and-set:
285285
// - If key doesn't exist, inserts our capsule and returns it.
286286
// - If key exists (another thread inserted first), returns the existing value.
287287
// This is thread-safe because `PyDict_SetDefault` will hold a lock on the dict.
288288
//
289-
// NOTE: Here we use `dict_setdefaultstring` instead of `dict_setdefaultstringref`
290-
// because the capsule is kept alive until interpreter shutdown, so we do not need to
291-
// handle incref and decref here.
289+
// NOTE: Here we use `PyDict_SetDefault` instead of `PyDict_SetDefaultRef` because the
290+
// capsule is kept alive until interpreter shutdown, so we do not need to handle incref
291+
// and decref here.
292292
capsule_obj
293293
= detail::dict_setdefaultstring(state_dict.ptr(), key.c_str(), new_capsule.ptr());
294294
if (capsule_obj == nullptr) {

0 commit comments

Comments
 (0)