-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[smart_holder] Bug fix: std::unique_ptr
deleter needs to be copied.
#4850
Commits on Sep 19, 2023
-
Store
std::function<void (void *)>
del_fun; inguarded_delete
Ralf W. Grosse-Kunstleve committedSep 19, 2023 Configuration menu - View commit details
-
Copy full SHA for f14846d - Browse repository at this point
Copy the full SHA f14846dView commit details -
Specialize the simple common case.
Using a `union` is complicated: https://en.cppreference.com/w/cpp/language/union > If members of a union are classes with user-defined constructors and destructors, to switch the active member, explicit destructor and placement new are generally needed: Using `std::variant` increases compile-time overhead. It is currently unclear how much these effects matter in practice: optimization left for later.
Ralf W. Grosse-Kunstleve committedSep 19, 2023 Configuration menu - View commit details
-
Copy full SHA for 24bf40b - Browse repository at this point
Copy the full SHA 24bf40bView commit details -
Add one test case (more later).
Ralf W. Grosse-Kunstleve committedSep 19, 2023 Configuration menu - View commit details
-
Copy full SHA for 884fe1c - Browse repository at this point
Copy the full SHA 884fe1cView commit details -
Add
const
to resolve clang-tidy error.``` -- The CXX compiler identification is Clang 15.0.7 /usr/bin/cmake -E __run_co_compile --tidy="/usr/bin/clang-tidy;--use-color;--warnings-as-errors=*;--extra-arg-before=--driver-mode=g++" --source=/__w/pybind11/pybind11/tests/test_class_sh_inheritance.cpp -- /usr/bin/c++ -DPYBIND11_ENABLE_TYPE_CASTER_ODR_GUARD_IF_AVAILABLE -DPYBIND11_TEST_EIGEN -Dpybind11_tests_EXPORTS -I/__w/pybind11/pybind11/include -isystem /usr/include/python3.9 -isystem /__w/pybind11/pybind11/build/_deps/eigen-src -Os -DNDEBUG -fPIC -fvisibility=hidden -Wall -Wextra -Wconversion -Wcast-qual -Wdeprecated -Wundef -Wnon-virtual-dtor -flto=thin -std=c++17 -o CMakeFiles/pybind11_tests.dir/test_class_sh_inheritance.cpp.o -c /__w/pybind11/pybind11/tests/test_class_sh_inheritance.cpp /__w/pybind11/pybind11/tests/pure_cpp/smart_holder_poc_test.cpp:264:30: error: pointer parameter 'raw_ptr' can be pointer to const [readability-non-const-parameter,-warnings-as-errors] new int(19), [](int *raw_ptr) { delete raw_ptr; }); ^ const ```
Ralf W. Grosse-Kunstleve committedSep 19, 2023 Configuration menu - View commit details
-
Copy full SHA for 435d386 - Browse repository at this point
Copy the full SHA 435d386View commit details
Commits on Sep 22, 2023
-
Introduce
struct custom_deleter
to ensure the deleter is moved as d……esired (the lambda function only captures a reference, which can become dangling).
Ralf W. Grosse-Kunstleve committedSep 22, 2023 Configuration menu - View commit details
-
Copy full SHA for 17098eb - Browse repository at this point
Copy the full SHA 17098ebView commit details -
Resolve helpful clang-tidy errors.
``` /usr/bin/cmake -E __run_co_compile --tidy="/usr/bin/clang-tidy;--use-color;--warnings-as-errors=*;--extra-arg-before=--driver-mode=g++" --source=/__w/pybind11/pybind11/tests/test_class.cpp -- /usr/bin/c++ -DPYBIND11_ENABLE_TYPE_CASTER_ODR_GUARD_IF_AVAILABLE -DPYBIND11_TEST_EIGEN -Dpybind11_tests_EXPORTS -I/__w/pybind11/pybind11/include -isystem /usr/include/python3.9 -isystem /__w/pybind11/pybind11/build/_deps/eigen-src -Os -DNDEBUG -fPIC -fvisibility=hidden -Wall -Wextra -Wconversion -Wcast-qual -Wdeprecated -Wundef -Wnon-virtual-dtor -flto=thin -std=c++17 -o CMakeFiles/pybind11_tests.dir/test_class.cpp.o -c /__w/pybind11/pybind11/tests/test_class.cpp /__w/pybind11/pybind11/include/pybind11/detail/smart_holder_poc.h:114:5: error: single-argument constructors must be marked explicit to avoid unintentional implicit conversions [google-explicit-constructor,-warnings-as-errors] custom_deleter(D &&deleter) : deleter{std::move(deleter)} {} ^ explicit /__w/pybind11/pybind11/include/pybind11/detail/smart_holder_poc.h:120:76: error: forwarding reference passed to std::move(), which may unexpectedly cause lvalues to be moved; use std::forward() instead [bugprone-move-forwarding-reference,-warnings-as-errors] return guarded_delete(std::function<void(void *)>(custom_deleter<T, D>(std::move(uqp_del))), ^~~~~~~~~ std::forward<D> ```
Ralf W. Grosse-Kunstleve committedSep 22, 2023 Configuration menu - View commit details
-
Copy full SHA for 6083f8a - Browse repository at this point
Copy the full SHA 6083f8aView commit details -
Workaround for gcc 4.8.5, clang 3.6
Ralf W. Grosse-Kunstleve committedSep 22, 2023 Configuration menu - View commit details
-
Copy full SHA for d815d7d - Browse repository at this point
Copy the full SHA d815d7dView commit details
Commits on Nov 1, 2023
-
Merge branch 'smart_holder' into unique_ptr_deleter_sh
Ralf W. Grosse-Kunstleve committedNov 1, 2023 Configuration menu - View commit details
-
Copy full SHA for 4dbe657 - Browse repository at this point
Copy the full SHA 4dbe657View commit details -
Reduced from a PyCLIF use case in the wild by @wangxf123456 (internal change cl/565476030).
Ralf W. Grosse-Kunstleve committedNov 1, 2023 Configuration menu - View commit details
-
Copy full SHA for c684f6c - Browse repository at this point
Copy the full SHA c684f6cView commit details -
Add missing include (clangd Include Cleaner)
Ralf W. Grosse-Kunstleve committedNov 1, 2023 Configuration menu - View commit details
-
Copy full SHA for a685d57 - Browse repository at this point
Copy the full SHA a685d57View commit details -
Change
std::move
tostd::forward
as suggested by @iwanders.Ralf W. Grosse-Kunstleve committedNov 1, 2023 Configuration menu - View commit details
-
Copy full SHA for 8a973d4 - Browse repository at this point
Copy the full SHA 8a973d4View commit details -
Add missing includes (clangd Include Cleaner)
Ralf W. Grosse-Kunstleve committedNov 1, 2023 Configuration menu - View commit details
-
Copy full SHA for 4fb7d12 - Browse repository at this point
Copy the full SHA 4fb7d12View commit details -
Use new
PYBIND11_TESTS_PURE_CPP_SMART_HOLDER_POC_TEST_CPP
to exclud……e `smart_holder::as_unique_ptr` method from production code.
Ralf W. Grosse-Kunstleve committedNov 1, 2023 Configuration menu - View commit details
-
Copy full SHA for 4d9d722 - Browse repository at this point
Copy the full SHA 4d9d722View commit details -
Systematically add `PYBIND11_TESTS_PURE_CPP_SMART_HOLDER_POC_TEST_CPP…
…` to mark code that is not used from production code. Add comment to explain.
Ralf W. Grosse-Kunstleve committedNov 1, 2023 Configuration menu - View commit details
-
Copy full SHA for 7669a5b - Browse repository at this point
Copy the full SHA 7669a5bView commit details -
Very simple experiment related to pybind#4850 (comment)
Does the `PYBIND11_TESTS_PURE_CPP_SMART_HOLDER_POC_TEST_CPP` define have anything to do with it?
Ralf W. Grosse-Kunstleve committedNov 1, 2023 Configuration menu - View commit details
-
Copy full SHA for fe59369 - Browse repository at this point
Copy the full SHA fe59369View commit details -
Revert "Very simple experiment related to pybind#4850 (comment)"
This reverts commit fe59369.
Ralf W. Grosse-Kunstleve committedNov 1, 2023 Configuration menu - View commit details
-
Copy full SHA for 821e13a - Browse repository at this point
Copy the full SHA 821e13aView commit details