-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Add support for nested C++11 exceptions #3608
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
Merged
Skylion007
merged 21 commits into
pybind:master
from
Skylion007:support-nested-exceptions
Jan 14, 2022
Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
ab9a1ec
Add support for nested C++11 exceptions
Skylion007 269da46
Remove wrong include
Skylion007 bf438d9
Fix if directive
Skylion007 42d5833
Fix missing skipif
Skylion007 a1ac841
Simplify code and try to work around MSVC bug
Skylion007 4cf2754
Clarify comment
Skylion007 eb13bef
Further simplify code
Skylion007 b89620a
Remove the last extra throw statement
Skylion007 09d1ad5
Qualify auto
Skylion007 3a9156c
Fix typo
Skylion007 5145500
Add missing return for consistency
Skylion007 d2b87f2
Fix clang-tidy complaint
Skylion007 c745ee3
Fix python2 stub
Skylion007 442d958
Make clang-tidy happy
Skylion007 d369c87
Fix compile error
Skylion007 c49df0d
Fix python2 function signature
Skylion007 2578c87
Extract C++20 utility and backport
Skylion007 1c526cf
Cleanup code a bit more
Skylion007 65a5ad8
Improve test case
Skylion007 e6cbe62
Consolidate code and fix signature
Skylion007 3fa58ee
Fix typo
Skylion007 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
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.
Forward declarations should never have
inline
:https://stackoverflow.com/questions/9317473/forward-declaration-of-inline-functions
(I find this highly counter-intuitive myself.)
Uh oh!
There was an error while loading. Please reload this page.
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.
C99 requires the inline on the definition; are you sure C++ cares? Looking at the spec, it seems clearly allowed unless it's nested inside another function https://en.cppreference.com/w/cpp/language/inline & https://en.cppreference.com/w/cpp/language/declarations#Specifiers seem to indicate it's allowed, and I didn't have any problems on any complier I quickly checked on godbolt.
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.
Ouch.
My previous comment was based on what I remembered from working on
#3179.
From memory, in a Google-internal chat I was advised to not use
inline
in forward declarations.Am I sure? No. I was asking for advice and then going with that. The work on PR #3179 left me believing that even compilers are unusually confused about what is correct.
To be pragmatic, we can reduce it to: do we want to be consistent within pybind11? PR #3179 removed some
inline
based on the advice I got, and to be consistent.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.
@rwgk Other forward declare (line 40) still use inline.
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 intentionally kept #3179 limited to functions involving
PYBIND11_NOINLINE
. I didn't look around too much, as I very often do, to not let a good project die the death of a thousand cuts.For this PR, idk. If we're inconsistent already and the advice I got in Aug last year isn't universally accepted (as I was thinking until now) ... shrug :-)