Segmentation fault at exit, copying a Python function into a static member of a C++ class #3508
Unanswered
mydatamodels
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
callback_test.tar.gz
Hello there.
The purpose of this minimal test case is to save a Python function into a static member of a C++ class.
We need this because in the real project we're working on, this function will be called from a multitude of instantiated objects.
We want to avoid copying the same thing repeatedly (and also this doesn't work for us and we can't isolate a minimal case to reproduce the problem, but that's another sad story) and these objects are not accessible directly from the Python client.
If the class member is non-static everything works like a charm.
If static, execution happens as before but we get a segmentation fault exiting:
Can someone tell me what's wrong with copying the function into a static member, please?
pybind11 v2.8.1
gcc 9.3.0
python 3.9.7
Beta Was this translation helpful? Give feedback.
All reactions