Uh oh!
There was an error while loading. Please reload this page.
Explicitly export exception types. - #2999
Conversation
27e301e to
14368b7Comparerwgk
commented
May 21, 2021
The CI looks good. |
Co-authored-by: XZiar <czktc2007@gmail.com>
14368b7 to
42b01fbCompareoraluben
commented
May 22, 2021
Hi @rwgk , the idea sounds good. Currently, I'm only aware of the |
I'm not very familiar with the exception handling code in pybind11 myself, but at first sight there is hope it could be straightforward adding to existing tests:
Do those look like a useful starting point? JIC you haven't seen this already, this includes instructions for running the tests: https://github.com/pybind/pybind11/blob/master/.github/CONTRIBUTING.md |
oraluben
commented
May 23, 2021
Hi @rwgk, I've added a test and updated some docs, does that look good to you? (I'll refine some word/name, e.g. |
rwgk
commented
May 24, 2021
Hi @oraluben, the macos PyPy tests are failing. Did you see that already? |
oraluben
commented
May 25, 2021
I take a look at it but can't understand at all. I haven't used Pypy, but I doubt that Pypy has special library handling/importing behaviour, because after setting the visibility of exceptions to default, the hashcodes of thrown/caught exceptions are still different, which cause the I'll just skip the test when pypy+libc++ for now and see if I can find more later. |
4fda9b1 to
a07fc60Comparerwgk
commented
May 25, 2021
Almost! :-) |
a07fc60 to
2b3315dCompare2b3315d to
97773dbCompareformat fixed and passed |
oraluben
commented
May 26, 2021
Found related #1272, trying to remove unused workaround code. |
oraluben
commented
May 26, 2021
The latest commit removes some old workaround for this issue, which passed tests locally. If there's any failure in the CI (most likely in PyPy) I'll revert it. |
rwgk
commented
May 26, 2021
Yep, PyPy failing again. BTW: I still need to find time to verify that the new test fails without the core change, and run this PR through our Google-internal testing (no issues expected, but standard practice). Hopefully later today. |
a913af8 to
1defec9Compareoraluben
commented
May 26, 2021
reverted & doc updated.
test-only version can be found at #3016, failed as expected. |
rwgk
commented
May 26, 2021
Awesome, thanks! Verified by triggering the CI. |
rwgk
left a comment
There was a problem hiding this comment.
Looks great, just some minor suggestions.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
rwgk
commented
May 27, 2021
The Google-internal global testing came back successful, too. We're ready to merge this PR, but could you please review the "Suggested changelog entry" I added to the PR description? Please modify as needed. I'll merge this PR after you confirm the Description and Suggested change log entry are final. |
oraluben
commented
May 27, 2021
Thanks for your help! "setting visibility" is not concrete on the second thought, since the statement is Linux-only but this PR actually affects MSVC (see failed Windows CIs in #3016). I've updated the title and some parts of the Suggested changelog entry, the rest looks perfect! The messages are final if they look good to you. |
Background: pybind#2999, pybind#4105, pybind#4283, pybind#4284 In a nutshell: * Only macOS actually needs `PYBIND11_EXPORT_EXCEPTION` (pybind#4284). * Evidently (pybind#4283), under macOS `PYBIND11_EXPORT_EXCEPTION` does not run the risk of introducing ODR violations, * but evidently (pybind#4283) under Linux it does, in the presumably rare/unusual situation that `RTLD_GLOBAL` is used. * Windows does no have the equivalent of `RTLD_GLOBAL`, therefore `PYBIND11_EXPORT_EXCEPTION` has no practical benefit, on the contrary, noisy warning suppression pragmas are needed, therefore it is best left empty.
…#4298) Background: #2999, #4105, #4283, #4284 In a nutshell: * Only macOS actually needs `PYBIND11_EXPORT_EXCEPTION` (#4284). * Evidently (#4283), under macOS `PYBIND11_EXPORT_EXCEPTION` does not run the risk of introducing ODR violations, * but evidently (#4283) under Linux it does, in the presumably rare/unusual situation that `RTLD_GLOBAL` is used. * Windows does no have the equivalent of `RTLD_GLOBAL`, therefore `PYBIND11_EXPORT_EXCEPTION` has no practical benefit, on the contrary, noisy warning suppression pragmas are needed, therefore it is best left empty.
…#4298) Background: #2999, #4105, #4283, #4284 In a nutshell: * Only macOS actually needs `PYBIND11_EXPORT_EXCEPTION` (#4284). * Evidently (#4283), under macOS `PYBIND11_EXPORT_EXCEPTION` does not run the risk of introducing ODR violations, * but evidently (#4283) under Linux it does, in the presumably rare/unusual situation that `RTLD_GLOBAL` is used. * Windows does no have the equivalent of `RTLD_GLOBAL`, therefore `PYBIND11_EXPORT_EXCEPTION` has no practical benefit, on the contrary, noisy warning suppression pragmas are needed, therefore it is best left empty.
Description
closes#2847 by setting visibility of exceptions to default. cc @XZiar
closes#3016
Suggested changelog entry:
``pybind11::builtin_exception`` is now explicitly exported, which means the types included/defined in different modules are identical, and exceptions raised in different modules can be caught correctly. The documentation was updated to explain that custom exceptions that are used across module boundaries need to be explicitly exported as well.