-
Notifications
You must be signed in to change notification settings - Fork 23
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
Python: Fix Interactive Inspection #265
Conversation
45f1a26
to
f0dc6d2
Compare
void init_ImpactX(py::module& m) | ||
namespace detail | ||
{ | ||
/** Helper Function for Property Getters |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can check in the future if we find a reasonable location to set default parameters without setting them multiple times throughout the code.
Maybe we need a ReadParameters
-like function called set_default_parameters
after all... :-S
When autocompleting the `ImpactX()` Python class, Ipython uses Jedi to look into the getters of properties. By default, the `ParmParse::get()` we use would throw an `amrex::Abort()`, which exits the interpreter. We could and should use `amrex.throw_exception = 1` and `amrex.signal_handling = 0` to make this a `std::runtime_error`. Unfortunately, this is still not sufficient to catch it, because C++ exception handlign accross shared libraries needs extra care. Thus, we just do a helper function, save some lines of code, and throw directly from ImpactX's Python module.
dfcc4a8
to
3c9c3c8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! :)
Also doesn't crash on Mac, anymore. ✨ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me and works fine on my Mac
When autocompleting the
ImpactX()
Python class, IPython uses Jedi to look into the getters of properties.By default, the
ParmParse::get()
we use would throw anamrex::Abort()
, which exits the interpreter.We could and should use
amrex.throw_exception = 1
andamrex.signal_handling = 0
to make this astd::runtime_error
. Unfortunately, this is still not sufficient to catch it, because C++ exception handling across shared libraries needs extra care.Thus, we just do a helper function, save some lines of code, and throw directly from ImpactX's Python module.
Thanks to @n01r for spotting this originally.
Follow-up to #260 and #223