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

Add test_class_sh_property_non_owning to CMakeLists.txt #4590

Merged
merged 6 commits into from
Mar 24, 2023

Conversation

rwgk
Copy link
Collaborator

@rwgk rwgk commented Mar 24, 2023

Description

Fixes oversight in PR #4586.

Suggested changelog entry:

@rwgk rwgk changed the title Missing cmake add pr4586 Add test_class_sh_property_non_owning to CMakeLists.txt Mar 24, 2023
@rwgk
Copy link
Collaborator Author

rwgk commented Mar 24, 2023

@wangxf123456 I'll go ahead merge this trivial PR, to make it a little easier to run global testing for smart_holder, and keep pywrapcc and smart_holder in sync.

@rwgk rwgk marked this pull request as ready for review March 24, 2023 07:07
@rwgk rwgk requested a review from henryiii as a code owner March 24, 2023 07:07
@rwgk rwgk merged commit 4f3a1a8 into pybind:smart_holder Mar 24, 2023
@rwgk rwgk deleted the missing_cmake_add_pr4586 branch March 24, 2023 07:07
@github-actions github-actions bot added the needs changelog Possibly needs a changelog entry label Mar 24, 2023
@rwgk rwgk removed the needs changelog Possibly needs a changelog entry label Mar 24, 2023
@rwgk
Copy link
Collaborator Author

rwgk commented Mar 24, 2023

For reasons I don't understand, the https://github.com/pybind/pybind11/pull/4590/files view here is misleading. The actual diff (git show 4f3a1a82318979147bfbdbf464774c316e555a17) is just this:

diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 3a1ce894..12b25808 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -130,6 +130,7 @@ set(PYBIND11_TEST_FILES
     test_class_sh_mi_thunks
     test_class_sh_module_local.py
     test_class_sh_property
+    test_class_sh_property_non_owning
     test_class_sh_shared_ptr_copy_move
     test_class_sh_trampoline_basic
     test_class_sh_trampoline_self_life_support
diff --git a/tests/test_class_sh_property_non_owning.cpp b/tests/test_class_sh_property_non_owning.cpp
index 5be72007..d15bf23a 100644
--- a/tests/test_class_sh_property_non_owning.cpp
+++ b/tests/test_class_sh_property_non_owning.cpp
@@ -27,10 +27,10 @@ private:
     std::vector<DataField> vec;

 public:
-    DataFieldsHolder(std::size_t vec_size) {
+    explicit DataFieldsHolder(std::size_t vec_size) {
         for (std::size_t i = 0; i < vec_size; i++) {
             int i11 = static_cast<int>(i) * 11;
-            vec.push_back(DataField(13 + i11, 14 + i11, 15 + i11));
+            vec.emplace_back(13 + i11, 14 + i11, 15 + i11);
         }
     }

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.

2 participants