Skip to content
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

cppyy update changed behavior of exceptions thrown in c++ and caught in python #15375

Closed
1 task done
tmadlener opened this issue Apr 29, 2024 · 3 comments · Fixed by #15485
Closed
1 task done

cppyy update changed behavior of exceptions thrown in c++ and caught in python #15375

tmadlener opened this issue Apr 29, 2024 · 3 comments · Fixed by #15485

Comments

@tmadlener
Copy link
Contributor

Check duplicate issues.

  • Checked for duplicates

Description

This is effectively a duplicate of wlav/cppyy#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

@tmadlener
Copy link
Contributor Author

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: wlav/CPyCppyy@02072bb

@guitargeek
Copy link
Contributor

Hi @tmadlener, yes that's very easy! I opened a PR. Thanks for pointing it out.

@guitargeek
Copy link
Contributor

Fixed in "not applicable" because no release was affected by this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment