-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Compile without exceptions #1703
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
Closed
Closed
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
cfb7185
Wrapping exception logic in #ifdefs to allow for compilation without …
453663e
Moving the Py_VersionCheckPassed function to the pybind11 namespace.
d642120
Making the version function an inline function and adding it to the d…
4fa14c5
Trigger CI.
5540fad
Test presubmits again.
4f49b32
Wrapping exception logic in #ifdefs to allow for compilation without …
ed773c1
Moving the Py_VersionCheckPassed function to the pybind11 namespace.
65dca2c
Making the version function an inline function and adding it to the d…
e3c54bc
Merge branch 'noexceptions' of github.com:av8ramit/pybind11 into noex…
f58351a
Merge remote-tracking branch 'upstream/master' into noexceptions
7184def
Applying the no exception logic to the new plugins and extending it t…
4a3ef83
Removing unecessary macro.
50d0473
Adding a changelog.
6348def
Add a minor note to the changelog.
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
So what happens now if constructing an extension module throws?
Imagine a line inside a user's
PYBIND11_MODULE
that sayspy::module foo = py::import("throwy_module");
and actually having a exception thrown from thethrowy_module
.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.
If you've set the flag PYBIND11_NOEXCEPTIONS and you run without enable exceptions I think it will fail to compile.
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.
I was talking about raising an exception from pure python, which can't be detected at compile time. I gave it a test and here are the two similar cases that I've tried:
If there is no
boom.py
in python's path, the following happens:And if we add a
boom.py
that looks like this:the error becomes more verbose:
Either way, it quickly calls
std::terminate()
, which is completely fine, but let's mention it in the changelog too.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.
Ah whoops, I totally misread that. Okay I'll update the changelog. Thanks @bstaletic