@@ -8,6 +8,45 @@ to a new version. But it goes into more detail. This includes things like
8
8
deprecated APIs and their replacements, build system changes, general code
9
9
modernization and other useful information.
10
10
11
+ v2.7
12
+ ====
13
+
14
+ The previously-deprecated constructor of ``py::module_ `` can now be used to
15
+ create a module that is *not * used as the top-level module of a C extension.
16
+ Previous use of the deprecated ``PYBIND11_PLUGIN `` macro without using
17
+ ``py::module_::create_extension_module `` will result in the following error
18
+ on import: ``SystemError: initialization of example did not return an extension module ``.
19
+
20
+ In this case, change the following double-deprecated, memory-leaking pattern:
21
+
22
+ .. code-block :: cpp
23
+
24
+ PYBIND11_PLUGIN(example) {
25
+ auto m = pybind11::module_("example", "pybind11 example plugin");
26
+ /// Set up bindings here
27
+ return m.ptr();
28
+ }
29
+
30
+ into this:
31
+
32
+ .. code-block :: cpp
33
+
34
+ static pybind11::module_::module_def example_module_def;
35
+ PYBIND11_PLUGIN(example) {
36
+ auto m = pybind11::module_::create_extension_module(
37
+ "example", "pybind11 example plugin", &example_module_def);
38
+ /// Set up bindings here
39
+ return m.ptr();
40
+ }
41
+
42
+ or, preferably, avoid the deprecated ``PYBIND11_PLUGIN `` completely:
43
+
44
+ .. code-block :: cpp
45
+
46
+ PYBIND11_MODULE(example, m) {
47
+ /// Set up bindings here
48
+ }
49
+
11
50
.. _upgrade-guide-2.6 :
12
51
13
52
v2.6
0 commit comments