Set 218 constructors as explicit to avoid implicit usage.
Fix for cppcheck warning:
Class has a constructor with 1 argument that is
not explicit. Such constructors should in general be explicit for
type safety reasons. Using the explicit keyword in the constructor
means some mistakes when using the class can be avoided.
For more information check:
https://www.codeproject.com/Articles/28663/Explicit-Constructor-in-C
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Previously relied on the caller of Gil() to
pass new_thread=true if they would be
calling from a different thread.
Enforce this with an assertion, by wrapping
PyThreadState in a SafeThreadState class
that remembers which POSIX thread
it's meant to be used in.
Signed-off-by: John Spray <john.spray@redhat.com>
Prep work for loading modules in separate python sub-interpreters.
According to the Python C API docs, mixing the PyGILState_*() API
with sub-interpreters is unsupported, so I've replaced these calls
with a Gil class, which will acquire and release the GIL against
a specific python thread state.
Note the manual python thread state creation in MgrPyModule::serve().
The PyGILState_*() APIs would have done that for us, but we're not
using them anymore, so have to do it by hand (see
https://docs.python.org/2/c-api/init.html#non-python-created-threads
for some description of this).
Signed-off-by: Tim Serong <tserong@suse.com>