Change internals ID and versioning scheme to avoid module conflicts #1012
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.
The current
PYBIND11_INTERNALS_ID
depends on the version of the library in order to isolate binary incompatibleinternals
capsules. However, this does not preclude conflicts between modules built from different (binary incompatible) commits with the same version number.For example, if one module was built with an early v2.2.dev and submitted to PyPI, it could not be loaded alongside a v2.2.x release module -- it would segfault because of incompatible internals with the same ID. (Well, whichever module was loaded first would work, but the second one would segfault on initialization.) I'm sure that a lot of projects include pybind11 as a submodule and check out a particular commit from the master branch.
This PR changes the ID to depend on
PYBIND11_INTERNALS_VERSION
which is independent of the main library version. It's an integer which should be incremented whenever a binary incompatible change is made tointernals
.PYBIND11_INTERNALS_KIND
is also introduced for a similar reason.Note: This would require some manual effort to make sure
PYBIND11_INTERNALS_VERSION
was correctly incremented for incompatible changes tointernals
or the related functions.