Repository navigation
Change internals ID and versioning scheme to avoid module conflicts - #1012
Conversation
|
Could we move the definition down a bit, right before |
0db6b51 to
a5f3cd9
Compare
|
I consolidated everything related to I also made a couple of tweaks as stated in the commit messages. I don't think there was any reason for using |
|
|
The current PYBIND11_INTERNALS_ID depends on the version of the library in order to isolate binary incompatible internals 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. 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 to internals. PYBIND11_INTERNALS_KIND is also introduced for a similar reason. The same versioning scheme is also applied to `type_info` and the `module_local` type attribute.
The current
PYBIND11_INTERNALS_IDdepends on the version of the library in order to isolate binary incompatibleinternalscapsules. 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_VERSIONwhich 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_KINDis also introduced for a similar reason.Note: This would require some manual effort to make sure
PYBIND11_INTERNALS_VERSIONwas correctly incremented for incompatible changes tointernalsor the related functions.