You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG]: Using smart_holder in virtual inheritance relationship error #5786
due to a fatal error condition:
SIGSEGV - Segmentation violation signal
But it is ok to use std::shared_ptr as py::class_ holder. Are there problems with my usage of the smart_holder.
Can anyone help me with this? It's urgent. Thank you very much!
Is this a regression? Put the last known working version here if it is.
Your reproducer looks valid. Yes, it should work, there is most likely some bug in the pybind11 smart_holder code.
Could you do me a favor and open a PR with an added test?
To get started, just create a new test_animal_cat_tiger.cpp and test_animal_cat_tiger.py pair of files under tests/ and add test_animal_cat_tiger to tests\CMakeLists.txt. It's really straightforward.
Maybe copy the pair of test_class_sh_unique_ptr_member.cpp,py files, throw away almost all of the existing code, plug in your code. Make it work with shared_ptr as holder first, then plug in smart_holder instead and push to a PR.
Maybe add [ci skip] to your top commit before pushing, so that our CI doesn't run unnecessarily.
@henryiii Could you maybe advise what's the latest recommended cmake command to use to build and run just one test locally?
Your reproducer looks valid. Yes, it should work, there is most likely some bug in the pybind11 smart_holder code.
Could you do me a favor and open a PR with an added test?
To get started, just create a new test_animal_cat_tiger.cpp and test_animal_cat_tiger.py pair of files under tests/ and add test_animal_cat_tiger to tests\CMakeLists.txt. It's really straightforward.
Maybe copy the pair of test_class_sh_unique_ptr_member.cpp,py files, throw away almost all of the existing code, plug in your code. Make it work with shared_ptr as holder first, then plug in smart_holder instead and push to a PR.
Maybe add [ci skip] to your top commit before pushing, so that our CI doesn't run unnecessarily.
@henryiii Could you maybe advise what's the latest recommended cmake command to use to build and run just one test locally?
To quickly run all the tests, you can set up your environment and then run cmake --workflow default, or if you have uv you can run cmake --workflow venv and let uv set up the environment for you. However, if you just want to run one test, you should split the commands up into their sub-parts (default or venv works here):
(Note that tests -> testsvenv if you use venv. We don't support actual CTest yet, it's just another build preset for testing. I hope to fix that someday.) I might have slightly missed the override syntax, too, I think there's no .py extension on the selection.
Activity
rwgk commentedon Aug 13, 2025
Your reproducer looks valid. Yes, it should work, there is most likely some bug in the pybind11 smart_holder code.
Could you do me a favor and open a PR with an added test?
To get started, just create a new
test_animal_cat_tiger.cppandtest_animal_cat_tiger.pypair of files undertests/and addtest_animal_cat_tigerto tests\CMakeLists.txt. It's really straightforward.Maybe copy the pair of
test_class_sh_unique_ptr_member.cpp,pyfiles, throw away almost all of the existing code, plug in your code. Make it work withshared_ptras holder first, then plug insmart_holderinstead and push to a PR.Maybe add
[ci skip]to your top commit before pushing, so that our CI doesn't run unnecessarily.@henryiii Could you maybe advise what's the latest recommended cmake command to use to build and run just one test locally?
MannixYang commentedon Aug 13, 2025
Thanks for your reply,I will do it
henryiii commentedon Aug 13, 2025
To quickly run all the tests, you can set up your environment and then run
cmake --workflow default, or if you have uv you can runcmake --workflow venvand let uv set up the environment for you. However, if you just want to run one test, you should split the commands up into their sub-parts (defaultorvenvworks here):(Note that
tests->testsvenvif you use venv. We don't support actual CTest yet, it's just another build preset for testing. I hope to fix that someday.) I might have slightly missed the override syntax, too, I think there's no.pyextension on the selection.rwgk commentedon Aug 14, 2025
Thanks @henryiii
FWIW, this worked for me, starting completely from scratch under Ubuntu 24.04:
To build and test everything:
Alternatively, building and running just one (existing) Python test: