Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git merge smart_holder #30151

Merged
merged 4 commits into from
Aug 25, 2024
Merged

git merge smart_holder #30151

merged 4 commits into from
Aug 25, 2024

Conversation

rwgk
Copy link
Contributor

@rwgk rwgk commented Aug 25, 2024

Description

Helper/scratch PR for testing.

Suggested changelog entry:

Ralf W. Grosse-Kunstleve added 4 commits August 25, 2024 08:41
PREPARATION for:

PR google#5332 — Fix handling of const unique_ptr<T, D> & (do not disown).

Splitting out so that the functional changes under PR google#5332 will be more obvious.
…#5334)

PREPARATION for:

PR google#5332 — Fix handling of const unique_ptr<T, D> & (do not disown).

Splitting out so that the functional changes under PR google#5332 will be more obvious.

The only functional change under this PR is that

```
            assert(custom_deleter_ptr != nullptr);
```

is replaced with:

```
            if (custom_deleter_ptr == nullptr) {
                throw std::runtime_error(
                    std::string("smart_holder::extract_deleter() precondition failure (") + context
                    + ").");
            }
```
…own). (google#5332)

* Replace `unique_ptr_cref_roundtrip()` with `pass_unique_ptr_cref()`, `rtrn_unique_ptr_cref()` to make the current behavior obvious.

* add in unique_ptr_storage, unique_ptr_storage_deleter

* Add shared_ptr_storage (with that disowning fails as expected).

* Add load_as_const_unique_ptr()

* Restore original struct_smart_holder.h

* factor out `smart_holder::extract_deleter()`

* Better error message.

* Misc cleanup/tidying.

* Use `re.match("ctor_arg(_MvCtor)*_MvCtor", ...)` for compatibility with MSVC, NVHPC, ICC

* Add small comments.

* Fix small, inconsequential oversight in test code.

* Apply suggestion by @iwanders under PR google#5334

* Remove `std::move()` in `smart_holder::extract_deleter()`

* Add `static_assert()` following a suggestion by @iwanders under PR google#5334
@rwgk rwgk marked this pull request as ready for review August 25, 2024 19:33
@rwgk rwgk merged commit e9b80a3 into google:main Aug 25, 2024
73 checks passed
@rwgk rwgk deleted the pybind11k_merge_sh branch August 25, 2024 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant