Uh oh!
There was an error while loading. Please reload this page.
Open pybind11 namespace with consistent visility. - #4098
Conversation
rwgk
left a comment
There was a problem hiding this comment.
Thanks Thomas, this looks good to me.
From a small experiment under PR #4050 (merged into the smart_holder branch) I can confirm that this matters on some platforms (e.g. macOS while not using -fvisibility=hidden).
On a related note, I have a PR that shows that -fvisibility=hidden can be removed without losing any pybind11 features (#4072). When working on that PR I overlooked the changes this PR makes to the tests. I'm thinking that will never really matter, because nobody will run them with a mix of pybind11 versions, does that sound right? But regardless, being consistent is better, because test code is copied quite often as a starting point for something new.
See pybind/pybind11#4098 for explanation
Description
Pybind opens the
pybind11namespace in its library code viaPYBIND11_NAMESPACEto capture visibility settings. The documentation does not open thepybind11namespace the same way, This implies that forward declaring some pybind11 classes can be done withoutPYBIND11_NAMESPACE, but this is incorrect in the general case. Ultimately this leads to visibility mismatches depending on definition and include order.Suggested changelog entry: