summaryrefslogtreecommitdiffstats
path: root/pcilib
diff options
context:
space:
mode:
authorVasilii Chernov <vchernov@inr.ru>2016-02-17 18:13:36 +0100
committerVasilii Chernov <vchernov@inr.ru>2016-02-17 18:13:36 +0100
commit52eb7f4fb76ddf99dedf44332aae7af4df76ab36 (patch)
tree607cd6617966ad9d9998ce0af87f1142de957a0c /pcilib
parent9a9ffd5594a5d27bbecf6160de2c33d44870f5bd (diff)
downloadpcitool-52eb7f4fb76ddf99dedf44332aae7af4df76ab36.tar.gz
pcitool-52eb7f4fb76ddf99dedf44332aae7af4df76ab36.tar.bz2
pcitool-52eb7f4fb76ddf99dedf44332aae7af4df76ab36.tar.xz
pcitool-52eb7f4fb76ddf99dedf44332aae7af4df76ab36.zip
Add test to repository. Add GIL states to pcilib_set_value_from_pyobject
Diffstat (limited to 'pcilib')
-rw-r--r--pcilib/py.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/pcilib/py.c b/pcilib/py.c
index 372d475..a288043 100644
--- a/pcilib/py.c
+++ b/pcilib/py.c
@@ -347,6 +347,7 @@ int pcilib_set_value_from_pyobject(pcilib_t* ctx, pcilib_value_t *val, pcilib_py
PyObject* pyVal = pyObjVal;
int err;
+ PyGILState_STATE gstate = PyGILState_Ensure();
if(PyInt_Check(pyVal))
{
err = pcilib_set_value_from_int(ctx, val, PyInt_AsLong(pyVal));
@@ -359,9 +360,11 @@ int pcilib_set_value_from_pyobject(pcilib_t* ctx, pcilib_value_t *val, pcilib_py
err = pcilib_set_value_from_static_string(ctx, val, PyString_AsString(pyVal));
else
{
+ PyGILState_Release(gstate);
pcilib_error("Invalid input. Input type should be int, float or string.");
return PCILIB_ERROR_NOTSUPPORTED;
}
+ PyGILState_Release(gstate);
if(err)
return err;