mirror of
https://github.com/pybind/pybind11.git
synced 2026-04-20 06:49:25 +00:00
docs: show nogil in most examples (#5770)
Created using [mini-swe-agent](https://mini-swe-agent.com) and the propmt: I'd like to find usages of PYBIND11_MODULE in the docs folder and add py::mod_gil_not_used() as a third argument if there ar e only two arguments. These are examples, and it's really a good idea to always include that now. I removed a few of the changes. Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
This commit is contained in:
@@ -27,7 +27,7 @@ The binding code for ``Pet`` looks as follows:
|
||||
|
||||
namespace py = pybind11;
|
||||
|
||||
PYBIND11_MODULE(example, m) {
|
||||
PYBIND11_MODULE(example, m, py::mod_gil_not_used()) {
|
||||
py::class_<Pet>(m, "Pet")
|
||||
.def(py::init<const std::string &>())
|
||||
.def("setName", &Pet::setName)
|
||||
@@ -480,7 +480,7 @@ management. For example, ownership is inadvertently transferred here:
|
||||
std::shared_ptr<Child> child;
|
||||
};
|
||||
|
||||
PYBIND11_MODULE(example, m) {
|
||||
PYBIND11_MODULE(example, m, py::mod_gil_not_used()) {
|
||||
py::class_<Child, std::shared_ptr<Child>>(m, "Child");
|
||||
|
||||
py::class_<Parent, std::shared_ptr<Parent>>(m, "Parent")
|
||||
|
||||
Reference in New Issue
Block a user