Add successfully initialized a module object to the internal cache. The module must have a __spec__ attribute with a name attribute. */
| 1521 | The module must have a __spec__ attribute with a name attribute. |
| 1522 | */ |
| 1523 | inline void cache_completed_module(pybind11::object const &mod) { |
| 1524 | dict state = detail::get_python_state_dict(); |
| 1525 | if (!state.contains("__pybind11_module_cache")) { |
| 1526 | state["__pybind11_module_cache"] = dict(); |
| 1527 | } |
| 1528 | state["__pybind11_module_cache"][mod.attr("__spec__").attr("name")] = mod; |
| 1529 | } |
| 1530 | |
| 1531 | /* |
| 1532 | A Py_mod_create slot function which will return the previously created module from the cache if one |
nothing calls this directly
no test coverage detected