cppyy update changed behavior of exceptions thrown in c++ and caught in python
Check duplicate issues.
- [X] Checked for duplicates
Description
This is effectively a duplicate of https://github.com/wlav/cppyy/issues/230. I am reporting it here mainly because this is also a behavioral change for ROOT, and I am not entirely sure whether it was introduced as part of the larger cppyy update or later (in which case it could maybe be fixed).
Reproducer
import ROOT
ROOT.gInterpreter.LoadText(
"""
class Foo {
public:
void bar() { throw std::logic_error("This is fine"); }
void bar() const { throw std::logic_error("This is fine"); }
};
"""
)
foo = ROOT.Foo()
try:
foo.bar()
except ROOT.std.logic_error:
print("Caught")
pass
ROOT version
The above worked up to root 6.30.06 and still works with the root version one gets when using a dev4 release. It doesn't work with a dev3 release at the moment.
Installation method
various (spack, LCG releases)
Operating system
various (verified on Ubuntu 22)
Additional context
No response
I am not sure how easy it is to pick this up, but @wlav seems to have been able to fix this with this commit: https://github.com/wlav/CPyCppyy/commit/02072bbd818501364b37c133364e02976af4cc10
Hi @tmadlener, yes that's very easy! I opened a PR. Thanks for pointing it out.
Fixed in "not applicable" because no release was affected by this.