-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Test PR: Private inheritance triggering RuntimeError: Tried to call pure virtual function "…"
#5855
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
base: master
Are you sure you want to change the base?
Conversation
The CI failures are because of this (caveat: I only looked at one log):
Interactive testing after fixing that:
To resolve that error: diff --git a/tests/test_class_sh_virtual_py_cpp_mix.py b/tests/test_class_sh_virtual_py_cpp_mix.py
index 83e9152c..38549ae7 100644
--- a/tests/test_class_sh_virtual_py_cpp_mix.py
+++ b/tests/test_class_sh_virtual_py_cpp_mix.py
@@ -70,7 +70,7 @@ def test_get_from_cpp_unique_ptr(ctor, expected):
class VirtualItemDerived(m.VirtualItem):
- def getInt(self):
+ def get(self):
return 42
In case your original issue was something related but different, could you please make changes to this PR and ensure that we actually see that error in the CI? |
35b717b
to
46280a7
Compare
ed9f340
to
69abfb5
Compare
RuntimeError: Tried to call pure virtual function "VirtualItem::get"
RuntimeError: Tried to call pure virtual function "…"
sorry for the ping. Not ready yet. |
Hi @rwgk, it took me days to find out why my usecase fails while the test I provided before does not. In my project the trampoline did not inherit from the base class Some setups give hints, but some, like mine, do not. Maybe you could add some static assertions or support private inheritance. Whichever you prefer, but please do either of them to save future pybind users some severely frustrating time. |
RuntimeError: Tried to call pure virtual function "…"
RuntimeError: Tried to call pure virtual function "…"
This PR is not meant to be merged but to provide a repoducer for the issue.
EDIT: Simplified the example and used the catch tests (embedded use case).