Skip to content

Commit

Permalink
mgr: return PyNone instead
Browse files Browse the repository at this point in the history
Signed-off-by: Pere Diaz Bou <pdiazbou@redhat.com>
  • Loading branch information
pereman2 committed May 26, 2021
1 parent 845a86e commit ce58c15
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/mgr/ActivePyModules.cc
Expand Up @@ -173,7 +173,7 @@ PyObject *ActivePyModules::get_python(const std::string &what)
PyObject *injected_map = Injector::get_python(what);
// Structures which have no injection implemented should
// return the usual PyObject*
if (injected_map != nullptr) return injected_map;
if (injected_map != Py_None) return injected_map;
}
PyFormatter f;

Expand Down
6 changes: 4 additions & 2 deletions src/mgr/Injector.cc
Expand Up @@ -35,7 +35,9 @@ PyObject* Injector::get_python(const std::string& what) {
Injector::mark_exists_osds(osdmap);
osdmap->dump(&f);
} else {
return nullptr;
Py_RETURN_NONE
}
return f.get();
PyObject *obj = f.get();
Py_INCREF(obj);
return obj;
}

0 comments on commit ce58c15

Please sign in to comment.