mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-29 08:32:02 +00:00
Merge branch 'master' into bakein
This commit is contained in:
commit
8ca559340c
@ -462,6 +462,22 @@ PYBIND11_WARNING_POP
|
|||||||
return "Hello, World!";
|
return "Hello, World!";
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
The third macro argument is optional (available since 2.13.0), and can be used to
|
||||||
|
mark the extension module as safe to run without the GIL under a free-threaded CPython
|
||||||
|
interpreter. Passing this argument has no effect on other interpreters.
|
||||||
|
|
||||||
|
.. code-block:: cpp
|
||||||
|
|
||||||
|
PYBIND11_MODULE(example, m, py::mod_gil_not_used()) {
|
||||||
|
m.doc() = "pybind11 example module safe to run without the GIL";
|
||||||
|
|
||||||
|
// Add bindings here
|
||||||
|
m.def("foo", []() {
|
||||||
|
return "Hello, Free-threaded World!";
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
\endrst */
|
\endrst */
|
||||||
#define PYBIND11_MODULE(name, variable, ...) \
|
#define PYBIND11_MODULE(name, variable, ...) \
|
||||||
static ::pybind11::module_::module_def PYBIND11_CONCAT(pybind11_module_def_, name) \
|
static ::pybind11::module_::module_def PYBIND11_CONCAT(pybind11_module_def_, name) \
|
||||||
|
Loading…
Reference in New Issue
Block a user