const std::string &module_name,
const std::string &key) const
{
+ PyThreadState *tstate = PyEval_SaveThread();
std::string value;
bool found = get_config(module_name, key, &value);
if (found) {
PyModuleRef module = py_module_registry.get_module(module_name);
+ PyEval_RestoreThread(tstate);
if (!module) {
derr << "Module '" << module_name << "' is not available" << dendl;
Py_RETURN_NONE;
}
-
dout(10) << __func__ << " " << key << " found: " << value << dendl;
return module->get_typed_option_value(key, value);
}
-
+ PyEval_RestoreThread(tstate);
dout(4) << __func__ << " " << key << " not found " << dendl;
Py_RETURN_NONE;
}
derr << "Invalid args!" << dendl;
return nullptr;
}
- PyThreadState *tstate = PyEval_SaveThread();
auto pResult = self->py_modules->get_typed_config(module, what);
- PyEval_RestoreThread(tstate);
return pResult;
}
PyObject *PyModule::get_typed_option_value(const std::string& name,
const std::string& value)
{
+ // we don't need to hold a lock here because these MODULE_OPTIONS
+ // are set up exactly once during startup.
auto p = options.find(name);
if (p != options.end()) {
switch (p->second.type) {