-
Notifications
You must be signed in to change notification settings - Fork 42
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
What is the expected behaviour when a C++ exception is uncaught? #237
Comments
What platform/version of cppyy gives you the first error? I get a Python |
My version of cppyy is Version: 3.1.2. I run it on macOS, but a colleague on Ubuntu also got the issue (I will double check with him tomorrow). Thanks for your reply! |
What seems strange is that the behaviour of throwing an exception with import cppyy
code = """
#include <exception>
throw std::domain_error("Exceptionnel");
"""
try:
cppyy.cppexec(code)
except Exception as e:
print(e) that returns: Failed to parse the given C++ code
compilation failed: Exceptionnel seems different from what we have when throwing an exception in a function: import cppyy
cppyy.cppdef("#include <exception>\nvoid exceptation() { throw std::domain_error(\"Exceptionnel\"); }")
try:
cppyy.gbl.exceptation()
except Exception as e:
print(e) returns: void ::exceptation() =>
domain_error: Exceptionnel |
Yes, b/c in the case of the former, the exception is caught by I'll note that run-time access to Cling seems to becoming a more common use case of cppyy, as generating code snippets, ie. string manipulation, is more convenient in Python than C++. But that's not the original purpose of the package and so several of these utilities are under-developed. These use cases will be easier to support in cppyy 4.0, based on |
Following code:
fails with error:
Same code when the exception is caught works without an hitch:
The text was updated successfully, but these errors were encountered: