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
avoid python C API segfault on intel mac #2455
Conversation
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 good to me, except this one thing. Just remove the empty_string.
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.
Thanks for this fix @stchaker. One more update you'll need in here is that we have an associated Python binding to this variable (hence why it is extern "C"
in the first place). That one will need to be updated too:
Lines 57 to 60 in e49c2c7
@property | |
def path_statepoint(self): | |
path = c_char_p.in_dll(_dll, 'path_statepoint').value | |
return path.decode() |
@stchaker are you interested in getting this branch updated? The review comments are very minor and should be easy to address. |
Sorry for the late reply/fix! I got swamped with some exams over the past two weeks. I went ahead and made those changes, thanks! |
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.
Thanks @stchaker!
@gridley Let us know if you have further requests on this PR. If not, please approve so that it can be merged. |
You can't reliably use extern "C" std::strings. The python C API ends up basically reinterpret casting path_statepoint, which is an std::string to char*. Depending on the libc++ implementation, this may segfault, as it does on my intel Mac. This failure can be seen in the cmfd_restart test, with this output below.