You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
static allocation for PyModuleDef, to portably avoid leak check errors.
This PR solves the same issue as #2019 (rolled back), but in a way that is
certain to be portable and will work for any leak checker.
The Python 3 documentation suggests `static` allocation for `PyModuleDef`:
* https://docs.python.org/3/c-api/module.html#initializing-c-modules
* The module definition struct, which holds all information needed to
create a module object. There is usually only one statically initialized
variable of this type for each module.
This PR changes the `PYBIND11_MODULE` macro accordingly: `static PyModuleDef mdef;`
The `pybind11::module::module` code is slightly refactored, with the idea
to make the future removal of Python 2 support straightforward.
0 commit comments