Skip to content

Commit b08b849

Browse files
authored
Introducing PYBIND11_INTERNALS_SH_DEF, replacing the approach of PR #2939. For compatibility with PR #3275. (#3283)
1 parent ce62ec5 commit b08b849

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

include/pybind11/detail/internals.h

+12-8
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,7 @@ struct type_info {
155155
};
156156

157157
/// Tracks the `internals` and `type_info` ABI version independent of the main library version
158-
#ifndef PYBIND11_USE_SMART_HOLDER_AS_DEFAULT
159158
#define PYBIND11_INTERNALS_VERSION 4
160-
#else
161-
// See README_smart_holder.rst:
162-
// Classic / Conservative / Progressive cross-module compatibility
163-
#define PYBIND11_INTERNALS_VERSION 1004
164-
#endif
165159

166160
/// On MSVC, debug and release builds are not ABI-compatible!
167161
#if defined(_MSC_VER) && defined(_DEBUG)
@@ -221,11 +215,21 @@ struct type_info {
221215
# endif
222216
#endif
223217

218+
/// See README_smart_holder.rst:
219+
/// Classic / Conservative / Progressive cross-module compatibility
220+
#ifndef PYBIND11_INTERNALS_SH_DEF
221+
# if defined(PYBIND11_USE_SMART_HOLDER_AS_DEFAULT)
222+
# define PYBIND11_INTERNALS_SH_DEF ""
223+
# else
224+
# define PYBIND11_INTERNALS_SH_DEF "_sh_def"
225+
# endif
226+
#endif
227+
224228
#define PYBIND11_INTERNALS_ID "__pybind11_internals_v" \
225-
PYBIND11_TOSTRING(PYBIND11_INTERNALS_VERSION) PYBIND11_INTERNALS_KIND PYBIND11_COMPILER_TYPE PYBIND11_STDLIB PYBIND11_BUILD_ABI PYBIND11_BUILD_TYPE "__"
229+
PYBIND11_TOSTRING(PYBIND11_INTERNALS_VERSION) PYBIND11_INTERNALS_KIND PYBIND11_COMPILER_TYPE PYBIND11_STDLIB PYBIND11_BUILD_ABI PYBIND11_BUILD_TYPE PYBIND11_INTERNALS_SH_DEF "__"
226230

227231
#define PYBIND11_MODULE_LOCAL_ID "__pybind11_module_local_v" \
228-
PYBIND11_TOSTRING(PYBIND11_INTERNALS_VERSION) PYBIND11_INTERNALS_KIND PYBIND11_COMPILER_TYPE PYBIND11_STDLIB PYBIND11_BUILD_ABI PYBIND11_BUILD_TYPE "__"
232+
PYBIND11_TOSTRING(PYBIND11_INTERNALS_VERSION) PYBIND11_INTERNALS_KIND PYBIND11_COMPILER_TYPE PYBIND11_STDLIB PYBIND11_BUILD_ABI PYBIND11_BUILD_TYPE PYBIND11_INTERNALS_SH_DEF "__"
229233

230234
/// Each module locally stores a pointer to the `internals` data. The data
231235
/// itself is shared among modules with the same `PYBIND11_INTERNALS_ID`.

0 commit comments

Comments
 (0)