@@ -33,7 +33,7 @@ Overview
33
33
What is fundamentally different?
34
34
--------------------------------
35
35
36
- - Traditional pybind11 has the concept of "smart-pointer is holder".
36
+ - Classic pybind11 has the concept of "smart-pointer is holder".
37
37
Interoperability between smart-pointers is completely missing. For
38
38
example, when using ``std::shared_ptr `` as holder, ``return ``-ing
39
39
a ``std::unique_ptr `` leads to undefined runtime behavior
@@ -101,7 +101,7 @@ holder:
101
101
py::classh<Foo>(m, "Foo");
102
102
}
103
103
104
- There are three small differences compared to traditional pybind11:
104
+ There are three small differences compared to classic pybind11:
105
105
106
106
- ``#include <pybind11/smart_holder.h> `` is used instead of
107
107
``#include <pybind11/pybind11.h> ``.
@@ -175,6 +175,49 @@ still being able to build the same code with classic pybind11. Please see
175
175
tests/test_classh_mock.cpp for an example.
176
176
177
177
178
+ Classic / conservative / progressive cross-module compatibility
179
+ ---------------------------------------------------------------
180
+
181
+ Currently there are essentially three modes for building a pybind11 extension module:
182
+
183
+ * Classic: pybind11 stable (e.g. v2.6.2) or current master
184
+ * Conservative: pybind11 smart_holder
185
+ * Progressive: pybind11 smart_holder with ``-DPYBIND11_USE_SMART_HOLDER_AS_DEFAULT ``
186
+
187
+ In environments that mix modules built with different modes, this is the compatibility
188
+ matrix for ``py::class_ ``-wrapped types:
189
+
190
+ .. list-table :: Compatibility matrix
191
+ :widths: auto
192
+ :header-rows: 2
193
+
194
+ * -
195
+ -
196
+ -
197
+ - Module 2
198
+ -
199
+ * -
200
+ -
201
+ - Classic
202
+ - Conservative
203
+ - Progressive
204
+ * -
205
+ - **Classic **
206
+ - full
207
+ - one-way
208
+ - isolated
209
+ * - **Module 1 **
210
+ - **Conservative **
211
+ - one-way
212
+ - full
213
+ - isolated
214
+ * -
215
+ - **Progressive **
216
+ - isolated
217
+ - isolated
218
+ - full
219
+
220
+
178
221
Trampolines and std::unique_ptr
179
222
-------------------------------
180
223
@@ -191,7 +234,7 @@ inherit from ``py::trampoline_self_life_support``, for example:
191
234
...
192
235
};
193
236
194
- This is the only difference compared to traditional pybind11. A fairly
237
+ This is the only difference compared to classic pybind11. A fairly
195
238
minimal but complete example is tests/test_class_sh_trampoline_unique_ptr.cpp.
196
239
197
240
@@ -200,7 +243,7 @@ Ideas for the long-term
200
243
201
244
The macros are clearly an inconvenience in many situations. Highly
202
245
speculative: to avoid the need for the macros, a potential approach would
203
- be to combine the traditional implementation (``type_caster_base ``) with
246
+ be to combine the classic implementation (``type_caster_base ``) with
204
247
the ``smart_holder_type_caster ``, but this will probably be very messy and
205
248
not great as a long-term solution. The ``type_caster_base `` code is very
206
249
complex already. A more maintainable approach long-term could be to work
0 commit comments