-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[PyROOT] Segfault when creating proxy to derived class with multiple overloads #7686
Comments
PyROOT does not pick up correctly methods such as `operator[]` or `size` from the parent classes and therefore fails to pythonize the proxies in Python correctly. Raising the respective methods in the hierarchy is a workaround for these issues, which are tracked in root-project#7686.
Another reproducer pointing in the same direction is here. The iteration over the vector class fails because the import ROOT
ROOT.gInterpreter.Declare('''
struct Base {
std::vector<float> data;
int size() { return data.size(); }
};
struct Vec : public Base {
// using Base::size; // comment in this line to fix the iteration!
void push_back(float x) { data.push_back(x); }
float* begin() { return &data[0]; }
float* end() { return &data[data.size() - 1]; }
float& operator[](int idx) { return data[idx]; }
void print() { for (auto x : data) std::cout << x << std::endl; }
};
''')
v = ROOT.Vec()
for i in [42, 43, 44]:
v.push_back(i)
v.print()
c = 0
for x in v:
print(c, x)
if c > 10:
raise Exception('Iteration failed!')
c += 1 |
PyROOT does not pick up correctly methods such as `operator[]` or `size` from the parent classes and therefore fails to pythonize the proxies in Python correctly. Raising the respective methods in the hierarchy is a workaround for these issues, which are tracked in root-project#7686.
PyROOT does not pick up correctly methods such as `operator[]` or `size` from the parent classes and therefore fails to pythonize the proxies in Python correctly. Raising the respective methods in the hierarchy is a workaround for these issues, which are tracked in root-project#7686.
PyROOT does not pick up correctly methods such as `operator[]` or `size` from the parent classes and therefore fails to pythonize the proxies in Python correctly. Raising the respective methods in the hierarchy is a workaround for these issues, which are tracked in root-project#7686.
PyROOT does not pick up correctly methods such as `operator[]` or `size` from the parent classes and therefore fails to pythonize the proxies in Python correctly. Raising the respective methods in the hierarchy is a workaround for these issues, which are tracked in root-project#7686.
PyROOT does not pick up correctly methods such as `operator[]` or `size` from the parent classes and therefore fails to pythonize the proxies in Python correctly. Raising the respective methods in the hierarchy is a workaround for these issues, which are tracked in root-project#7686.
PyROOT does not pick up correctly methods such as `operator[]` or `size` from the parent classes and therefore fails to pythonize the proxies in Python correctly. Raising the respective methods in the hierarchy is a workaround for these issues, which are tracked in root-project#7686.
PyROOT does not pick up correctly methods such as `operator[]` or `size` from the parent classes and therefore fails to pythonize the proxies in Python correctly. Raising the respective methods in the hierarchy is a workaround for these issues, which are tracked in root-project#7686.
PyROOT does not pick up correctly methods such as `operator[]` or `size` from the parent classes and therefore fails to pythonize the proxies in Python correctly. Raising the respective methods in the hierarchy is a workaround for these issues, which are tracked in root-project#7686.
PyROOT does not pick up correctly methods such as `operator[]` or `size` from the parent classes and therefore fails to pythonize the proxies in Python correctly. Raising the respective methods in the hierarchy is a workaround for these issues, which are tracked in #7686.
To be checked with the latest cppyy in the first place. Perhaps this will be fixed once we upgrade. |
Indeed, this will be fixed with the |
Hi @guitargeek, It appears this issue is closed, but wasn't yet added to a project. Please add upcoming versions that will include the fix, or 'not applicable' otherwise. Sincerely, |
Following reproducer fails with a segfault:
There's a corresponding issue submitted to upstream cppyy: https://bitbucket.org/wlav/cppyy/issues/334/segfault-when-creating-proxy-to-derived
This issues were found in the wake of RVec 2.0 (#7502) and may just scratch the surface of an issue in cppyy with picking up methods from derived classes. See the workarounds for
operator[]
andsize
in RVec 2.0 to avoid this problem.The text was updated successfully, but these errors were encountered: