Hello community, here is the log from the commit of package python-libvirt-python for openSUSE:Factory checked in at 2020-12-05 20:35:50 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-libvirt-python (Old) and /work/SRC/openSUSE:Factory/.python-libvirt-python.new.5913 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-libvirt-python" Sat Dec 5 20:35:50 2020 rev:42 rq:852458 version:6.10.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-libvirt-python/python-libvirt-python.changes 2020-11-05 21:53:06.180429280 +0100 +++ /work/SRC/openSUSE:Factory/.python-libvirt-python.new.5913/python-libvirt-python.changes 2020-12-05 20:36:01.534638326 +0100 @@ -1,0 +2,7 @@ +Wed Dec 2 00:16:15 UTC 2020 - James Fehlig <jfeh...@suse.com> + +- Update to 6.10.0 + - Add all new APIs and constants in libvirt 6.10.0 + - jsc#SLE-13688 + +------------------------------------------------------------------- Old: ---- libvirt-python-6.9.0.tar.gz New: ---- libvirt-python-6.10.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-libvirt-python.spec ++++++ --- /var/tmp/diff_new_pack.QKmoEC/_old 2020-12-05 20:36:02.074638873 +0100 +++ /var/tmp/diff_new_pack.QKmoEC/_new 2020-12-05 20:36:02.074638873 +0100 @@ -23,7 +23,7 @@ %define srcname libvirt-python Name: python-libvirt-python URL: https://libvirt.org/ -Version: 6.9.0 +Version: 6.10.0 Release: 0 Summary: Library providing a virtualization API License: LGPL-2.1-or-later ++++++ _service ++++++ --- /var/tmp/diff_new_pack.QKmoEC/_old 2020-12-05 20:36:02.102638902 +0100 +++ /var/tmp/diff_new_pack.QKmoEC/_new 2020-12-05 20:36:02.106638906 +0100 @@ -1,7 +1,7 @@ <services> <service name="tar_scm" mode="disabled"> <param name="filename">libvirt-python</param> - <param name="revision">v6.9.0</param> + <param name="revision">v6.10.0</param> <param name="scm">git</param> <param name="submodules">disable</param> <param name="url">https://gitlab.com/libvirt/libvirt-python.git</param> ++++++ libvirt-python-6.9.0.tar.gz -> libvirt-python-6.10.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvirt-python-6.9.0/.gitlab-ci.yml new/libvirt-python-6.10.0/.gitlab-ci.yml --- old/libvirt-python-6.9.0/.gitlab-ci.yml 2020-10-06 14:34:38.000000000 +0200 +++ new/libvirt-python-6.10.0/.gitlab-ci.yml 2020-11-27 19:09:15.000000000 +0100 @@ -34,6 +34,7 @@ - export LD_LIBRARY_PATH="$LIBDIR" - export PATH="$VROOT/bin:$PATH" - export PKG_CONFIG_PATH="$LIBDIR/pkgconfig" + - export CFLAGS="-Werror" script: - pushd "$PWD" - mkdir -p "$SCRATCH_DIR" @@ -54,6 +55,7 @@ stage: builds before_script: - export MAKEFLAGS="-j$(getconf _NPROCESSORS_ONLN)" + - export CFLAGS="-Werror" script: - $PYTHON setup.py build - $PYTHON setup.py install diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvirt-python-6.9.0/MANIFEST.in new/libvirt-python-6.10.0/MANIFEST.in --- old/libvirt-python-6.9.0/MANIFEST.in 2020-10-06 14:34:38.000000000 +0200 +++ new/libvirt-python-6.10.0/MANIFEST.in 2020-11-27 19:09:15.000000000 +0100 @@ -36,6 +36,7 @@ include libvirt-utils.c include libvirtaio.py include MANIFEST +include MANIFEST.in include README include sanitytest.py include setup.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvirt-python-6.9.0/examples/event-test.py new/libvirt-python-6.10.0/examples/event-test.py --- old/libvirt-python-6.9.0/examples/event-test.py 2020-10-06 14:34:38.000000000 +0200 +++ new/libvirt-python-6.10.0/examples/event-test.py 2020-11-27 19:09:15.000000000 +0100 @@ -636,6 +636,10 @@ print("myDomainEventBlockThresholdCallback: Domain %s(%s) block device %s(%s) threshold %d exceeded by %d" % ( dom.name(), dom.ID(), dev, path, threshold, excess)) +def myDomainEventMemoryFailureCallback(conn: libvirt.virConnect, dom: libvirt.virDomain, recipient: int, action: int, flags: int, opaque: _T) -> None: + print("myDomainEventMemoryFailureCallback: Domain %s(%s) memory failure recipient %d action %d flags %d" % ( + dom.name(), dom.ID(), recipient, action, flags)) + ########################################################################## # Network events @@ -788,6 +792,7 @@ vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_DEVICE_REMOVAL_FAILED, myDomainEventDeviceRemovalFailedCallback, None), vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_METADATA_CHANGE, myDomainEventMetadataChangeCallback, None), vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_BLOCK_THRESHOLD, myDomainEventBlockThresholdCallback, None), + vc.domainEventRegisterAny(None, libvirt.VIR_DOMAIN_EVENT_ID_MEMORY_FAILURE, myDomainEventMemoryFailureCallback, None), ] netcallbacks = [ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvirt-python-6.9.0/generator.py new/libvirt-python-6.10.0/generator.py --- old/libvirt-python-6.9.0/generator.py 2020-10-06 14:34:38.000000000 +0200 +++ new/libvirt-python-6.10.0/generator.py 2020-11-27 19:09:15.000000000 +0100 @@ -477,6 +477,8 @@ 'virNetworkPortGetParameters', 'virNetworkPortSetParameters', 'virDomainGetGuestInfo', + 'virDomainAuthorizedSSHKeysGet', + 'virDomainAuthorizedSSHKeysSet', } lxc_skip_impl = { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvirt-python-6.9.0/libvirt-override-api.xml new/libvirt-python-6.10.0/libvirt-override-api.xml --- old/libvirt-python-6.9.0/libvirt-override-api.xml 2020-10-06 14:34:38.000000000 +0200 +++ new/libvirt-python-6.10.0/libvirt-override-api.xml 2020-11-27 19:09:15.000000000 +0100 @@ -819,5 +819,20 @@ <arg name='params' type='virTypedParameterPtr' info='parameters containing the identity attributes'/> <arg name='flags' type='unsigned int' info='currently unused, pass 0'/> </function> + <function name='virDomainAuthorizedSSHKeysGet' file='python'> + <info>Fetch list of public SSH authorized keys for given user in domain.</info> + <return type='char *' info='list of authorized keys'/> + <arg name='domain' type='virDomainPtr' info='a domain object'/> + <arg name='user' type='const char *' info='user'/> + <arg name='flags' type='unsigned int' info='optional fine-tuning flags, currently unused, pass 0.'/> + </function> + <function name='virDomainAuthorizedSSHKeysSet' file='python'> + <info>Manipulate set of public SSH authorized keys for given user in domain.</info> + <return type='int' info='0 in case of success, -1 in case of failure.'/> + <arg name='domain' type='virDomainPtr' info='a domain object'/> + <arg name='user' type='const char *' info='user'/> + <arg name='keys' type='char *' info='optional list of authorized keys to set/append/remove'/> + <arg name='flags' type='int' info='optional OR'ed set of virDomainAuthorizedSSHKeysSetFlags'/> + </function> </symbols> </api> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvirt-python-6.9.0/libvirt-override-virConnect.py new/libvirt-python-6.10.0/libvirt-override-virConnect.py --- old/libvirt-python-6.9.0/libvirt-override-virConnect.py 2020-10-06 14:34:38.000000000 +0200 +++ new/libvirt-python-6.10.0/libvirt-override-virConnect.py 2020-11-27 19:09:15.000000000 +0100 @@ -261,6 +261,15 @@ cb(self, virDomain(self, _obj=dom), dev, path, threshold, excess, opaque) return 0 + def _dispatchDomainEventMemoryFailureCallback(self, dom: 'virDomain', recipient: int, action: int, flags: int, cbData: Dict[str, Any]) -> int: + """Dispatches event to python user domain memory failure event callbacks + """ + cb = cbData["cb"] + opaque = cbData["opaque"] + + cb(self, virDomain(self, _obj=dom), recipient, action, flags, opaque) + return 0 + def domainEventDeregisterAny(self, callbackID: int) -> None: """Removes a Domain Event Callback. De-registering for a domain callback will disable delivery of this event type """ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvirt-python-6.9.0/libvirt-override.c new/libvirt-python-6.10.0/libvirt-override.c --- old/libvirt-python-6.9.0/libvirt-override.c 2020-10-06 14:34:38.000000000 +0200 +++ new/libvirt-python-6.10.0/libvirt-override.c 2020-11-27 19:09:15.000000000 +0100 @@ -1856,7 +1856,7 @@ VIR_PY_TUPLE_SET_GOTO(info, 8, libvirt_intWrap((long)err->int2), cleanup); /* TODO pass conn and dom if available */ - result = PyEval_CallObject(libvirt_virPythonErrorFuncHandler, list); + result = PyObject_Call(libvirt_virPythonErrorFuncHandler, list, NULL); Py_XDECREF(result); } @@ -1961,7 +1961,7 @@ VIR_PY_TUPLE_SET_GOTO(list, 1, pycbdata, cleanup); PyErr_Clear(); - pyret = PyEval_CallObject(pycb, list); + pyret = PyObject_Call(pycb, list, NULL); if (PyErr_Occurred()) { PyErr_Print(); goto cleanup; @@ -5505,7 +5505,7 @@ VIR_PY_TUPLE_SET_GOTO(cb_args, 1, libvirt_virVoidPtrWrap(opaque), cleanup); VIR_PY_TUPLE_SET_GOTO(cb_args, 2, libvirt_virFreeCallbackWrap(ff), cleanup); - result = PyEval_CallObject(addHandleObj, pyobj_args); + result = PyObject_Call(addHandleObj, pyobj_args, NULL); if (!result) { PyErr_Print(); PyErr_Clear(); @@ -5538,7 +5538,7 @@ VIR_PY_TUPLE_SET_GOTO(pyobj_args, 0, libvirt_intWrap(watch), cleanup); VIR_PY_TUPLE_SET_GOTO(pyobj_args, 1, libvirt_intWrap(event), cleanup); - result = PyEval_CallObject(updateHandleObj, pyobj_args); + result = PyObject_Call(updateHandleObj, pyobj_args, NULL); if (!result) { PyErr_Print(); PyErr_Clear(); @@ -5566,7 +5566,7 @@ VIR_PY_TUPLE_SET_GOTO(pyobj_args, 0, libvirt_intWrap(watch), cleanup); - result = PyEval_CallObject(removeHandleObj, pyobj_args); + result = PyObject_Call(removeHandleObj, pyobj_args, NULL); if (result) { retval = 0; } else { @@ -5623,7 +5623,7 @@ VIR_PY_TUPLE_SET_GOTO(cb_args, 1, libvirt_virVoidPtrWrap(opaque), cleanup); VIR_PY_TUPLE_SET_GOTO(cb_args, 2, libvirt_virFreeCallbackWrap(ff), cleanup); - result = PyEval_CallObject(addTimeoutObj, pyobj_args); + result = PyObject_Call(addTimeoutObj, pyobj_args, NULL); if (!result) { PyErr_Print(); PyErr_Clear(); @@ -5654,7 +5654,7 @@ VIR_PY_TUPLE_SET_GOTO(pyobj_args, 0, libvirt_intWrap(timer), cleanup); VIR_PY_TUPLE_SET_GOTO(pyobj_args, 1, libvirt_intWrap(timeout), cleanup); - result = PyEval_CallObject(updateTimeoutObj, pyobj_args); + result = PyObject_Call(updateTimeoutObj, pyobj_args, NULL); if (!result) { PyErr_Print(); PyErr_Clear(); @@ -5681,7 +5681,7 @@ VIR_PY_TUPLE_SET_GOTO(pyobj_args, 0, libvirt_intWrap(timer), cleanup); - result = PyEval_CallObject(removeTimeoutObj, pyobj_args); + result = PyObject_Call(removeTimeoutObj, pyobj_args, NULL); if (result) { retval = 0; } else { @@ -7254,6 +7254,62 @@ #endif /* VIR_DOMAIN_EVENT_ID_BLOCK_THRESHOLD */ +#ifdef VIR_DOMAIN_EVENT_ID_MEMORY_FAILURE +static int +libvirt_virConnectDomainEventMemoryFailureCallback(virConnectPtr conn ATTRIBUTE_UNUSED, + virDomainPtr dom, + int recipient, + int action, + unsigned int flags, + void *opaque) +{ + PyObject *pyobj_cbData = (PyObject*)opaque; + PyObject *pyobj_dom; + PyObject *pyobj_ret = NULL; + PyObject *pyobj_conn; + PyObject *dictKey; + int ret = -1; + + LIBVIRT_ENSURE_THREAD_STATE; + + if (!(dictKey = libvirt_constcharPtrWrap("conn"))) + goto cleanup; + pyobj_conn = PyDict_GetItem(pyobj_cbData, dictKey); + Py_DECREF(dictKey); + + /* Create a python instance of this virDomainPtr */ + virDomainRef(dom); + if (!(pyobj_dom = libvirt_virDomainPtrWrap(dom))) { + virDomainFree(dom); + goto cleanup; + } + Py_INCREF(pyobj_cbData); + + /* Call the Callback Dispatcher */ + pyobj_ret = PyObject_CallMethod(pyobj_conn, + (char*)"_dispatchDomainEventMemoryFailureCallback", + (char*)"OiiiO", + pyobj_dom, recipient, action, flags, + pyobj_cbData); + + Py_DECREF(pyobj_cbData); + Py_DECREF(pyobj_dom); + + cleanup: + if (!pyobj_ret) { + DEBUG("%s - ret:%p\n", __FUNCTION__, pyobj_ret); + PyErr_Print(); + } else { + Py_DECREF(pyobj_ret); + ret = 0; + } + + LIBVIRT_RELEASE_THREAD_STATE; + return ret; +} +#endif /* VIR_DOMAIN_EVENT_ID_MEMORY_FAILURE */ + + static PyObject * libvirt_virConnectDomainEventRegisterAny(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) @@ -7379,6 +7435,11 @@ cb = VIR_DOMAIN_EVENT_CALLBACK(libvirt_virConnectDomainEventBlockThresholdCallback); break; #endif /* VIR_DOMAIN_EVENT_ID_BLOCK_THRESHOLD */ +#ifdef VIR_DOMAIN_EVENT_ID_MEMORY_FAILURE + case VIR_DOMAIN_EVENT_ID_MEMORY_FAILURE: + cb = VIR_DOMAIN_EVENT_CALLBACK(libvirt_virConnectDomainEventMemoryFailureCallback); + break; +#endif /* VIR_DOMAIN_EVENT_ID_MEMORY_FAILURE */ case VIR_DOMAIN_EVENT_ID_LAST: break; } @@ -10362,6 +10423,98 @@ #endif /* LIBVIR_CHECK_VERSION(5, 8, 0) */ +#if LIBVIR_CHECK_VERSION(6, 10, 0) +static PyObject * +libvirt_virDomainAuthorizedSSHKeysGet(PyObject *self ATTRIBUTE_UNUSED, + PyObject *args) +{ + PyObject *pyobj_dom = NULL; + virDomainPtr dom = NULL; + const char *user = NULL; + char **keys = NULL; + int nkeys; + size_t i; + unsigned int flags; + PyObject *ret = NULL; + + if (!PyArg_ParseTuple(args, (char *)"OsI:virDomainAuthorizedSSHKeysGet", + &pyobj_dom, &user, &flags)) + return NULL; + dom = (virDomainPtr) PyvirDomain_Get(pyobj_dom); + + LIBVIRT_BEGIN_ALLOW_THREADS; + nkeys = virDomainAuthorizedSSHKeysGet(dom, user, &keys, flags); + LIBVIRT_END_ALLOW_THREADS; + + if (nkeys < 0) + return VIR_PY_NONE; + + if ((ret = PyList_New(nkeys)) == NULL) + goto error; + + for (i = 0; i < nkeys; i++) + VIR_PY_LIST_SET_GOTO(ret, i, libvirt_constcharPtrWrap(keys[i]), error); + + done: + for (i = 0; i < nkeys; i++) + VIR_FREE(keys[i]); + VIR_FREE(keys); + return ret; + + error: + Py_CLEAR(ret); + goto done; +} + + +static PyObject * +libvirt_virDomainAuthorizedSSHKeysSet(PyObject *self ATTRIBUTE_UNUSED, + PyObject *args) +{ + PyObject *pyobj_dom = NULL; + virDomainPtr dom = NULL; + const char *user = NULL; + PyObject *pyobj_keys = NULL; + char **keys = NULL; + int nkeys = 0; + size_t i; + unsigned int flags; + int c_retval; + PyObject *py_retval = NULL; + + if (!PyArg_ParseTuple(args, (char *)"OsOI:virDomainAuthorizedSSHKeysSet", + &pyobj_dom, &user, &pyobj_keys, &flags)) + return NULL; + dom = (virDomainPtr) PyvirDomain_Get(pyobj_dom); + + if (PyList_Check(pyobj_keys)) { + nkeys = PyList_Size(pyobj_keys); + + if (VIR_ALLOC_N(keys, nkeys) < 0) + return PyErr_NoMemory(); + + for (i = 0; i < nkeys; i++) { + if (libvirt_charPtrUnwrap(PyList_GetItem(pyobj_keys, i), + &(keys[i])) < 0) + goto cleanup; + } + } + + LIBVIRT_BEGIN_ALLOW_THREADS; + c_retval = virDomainAuthorizedSSHKeysSet(dom, user, (const char **)keys, nkeys, flags); + LIBVIRT_END_ALLOW_THREADS; + + py_retval = libvirt_intWrap(c_retval); + cleanup: + for (i = 0 ; i < nkeys ; i++) + VIR_FREE(keys[i]); + VIR_FREE(keys); + + return py_retval; +} +#endif /* LIBVIR_CHECK_VERSION(6, 10, 0) */ + + /************************************************************************ * * * The registration stuff * @@ -10626,6 +10779,10 @@ #if LIBVIR_CHECK_VERSION(5, 8, 0) {(char *) "virConnectSetIdentity", libvirt_virConnectSetIdentity, METH_VARARGS, NULL}, #endif /* LIBVIR_CHECK_VERSION(5, 8, 0) */ +#if LIBVIR_CHECK_VERSION(6, 10, 0) + {(char *) "virDomainAuthorizedSSHKeysGet", libvirt_virDomainAuthorizedSSHKeysGet, METH_VARARGS, NULL}, + {(char *) "virDomainAuthorizedSSHKeysSet", libvirt_virDomainAuthorizedSSHKeysSet, METH_VARARGS, NULL}, +#endif /* LIBVIR_CHECK_VERSION(6, 10, 0) */ {NULL, NULL, 0, NULL} }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvirt-python-6.9.0/setup.py new/libvirt-python-6.10.0/setup.py --- old/libvirt-python-6.9.0/setup.py 2020-10-06 14:34:38.000000000 +0200 +++ new/libvirt-python-6.10.0/setup.py 2020-11-27 19:09:15.000000000 +0100 @@ -283,7 +283,9 @@ if self.plat_name is None: self.plat_name = get_platform() - plat_specifier = ".%s-%s" % (self.plat_name, sys.version[0:3]) + plat_specifier = ".%s-%d.%d" % (self.plat_name, + sys.version_info[0], + sys.version_info[1]) if hasattr(sys, 'gettotalrefcount'): plat_specifier += '-pydebug' @@ -339,7 +341,7 @@ _c_modules, _py_modules = get_module_lists() setup(name = 'libvirt-python', - version = '6.9.0', + version = '6.10.0', url = 'http://www.libvirt.org', maintainer = 'Libvirt Maintainers', maintainer_email = 'libvir-l...@redhat.com', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvirt-python-6.9.0/tests/test_conn.py new/libvirt-python-6.10.0/tests/test_conn.py --- old/libvirt-python-6.9.0/tests/test_conn.py 2020-10-06 14:34:38.000000000 +0200 +++ new/libvirt-python-6.10.0/tests/test_conn.py 2020-11-27 19:09:15.000000000 +0100 @@ -1,5 +1,8 @@ import unittest import libvirt +import tempfile +import contextlib +import os class TestLibvirtConn(unittest.TestCase): @@ -14,3 +17,76 @@ self.assertEquals(len(doms), 1) self.assertEquals(type(doms[0]), libvirt.virDomain) self.assertEquals(doms[0].name(), "test") + +class TestLibvirtConnAuth(unittest.TestCase): + connXML = """ +<node> + <auth> + <user password="2147483647">marin</user> + <user password="87539319">srinivasa</user> + </auth> +</node>""" + def setUp(self): + def noop(msg, opaque): + pass + libvirt.registerErrorHandler(noop, None) + + @contextlib.contextmanager + def tempxmlfile(content): + try: + fp = tempfile.NamedTemporaryFile(delete=False, + prefix="libvirt-python-test", + suffix=".xml") + fname = fp.name + fp.write(content.encode("utf8")) + fp.close() + yield fname + finally: + os.unlink(fname) + + def authHelper(self, username, password): + with TestLibvirtConnAuth.tempxmlfile(self.connXML) as fname: + magic = 142857 + def authCB(creds, opaque): + if opaque != magic: + return -1 + + for cred in creds: + if (cred[0] == libvirt.VIR_CRED_AUTHNAME and + username is not None): + cred[4] = username + return 0 + elif (cred[0] == libvirt.VIR_CRED_PASSPHRASE and + password is not None): + cred[4] = password + return 0 + return -1 + return 0 + + auth = [[libvirt.VIR_CRED_AUTHNAME, + libvirt.VIR_CRED_ECHOPROMPT, + libvirt.VIR_CRED_REALM, + libvirt.VIR_CRED_PASSPHRASE, + libvirt.VIR_CRED_NOECHOPROMPT, + libvirt.VIR_CRED_EXTERNAL], + authCB, magic] + + return libvirt.openAuth("test://" + fname, + auth, 0) + + def testOpenAuthGood(self): + conn = self.authHelper("srinivasa", "87539319") + + def testOpenAuthBad(self): + try: + conn = self.authHelper("srinivasa", "2147483647") + raise Exception("Unexpected open success") + except libvirt.libvirtError as ex: + pass + + def testOpenAuthNone(self): + try: + conn = self.authHelper(None, None) + raise Exception("Unexpected open success") + except libvirt.libvirtError as ex: + pass diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libvirt-python-6.9.0/typewrappers.h new/libvirt-python-6.10.0/typewrappers.h --- old/libvirt-python-6.9.0/typewrappers.h 2020-10-06 14:34:38.000000000 +0200 +++ new/libvirt-python-6.10.0/typewrappers.h 2020-11-27 19:09:15.000000000 +0100 @@ -255,28 +255,48 @@ # endif /* !(__GNUC__ && !__STRICT_ANSI__ && !__cplusplus) */ #endif -#define LIBVIRT_BEGIN_ALLOW_THREADS \ +#if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION < 7 +# define LIBVIRT_BEGIN_ALLOW_THREADS \ LIBVIRT_STMT_START { \ PyThreadState *_save = NULL; \ if (PyEval_ThreadsInitialized()) \ _save = PyEval_SaveThread(); -#define LIBVIRT_END_ALLOW_THREADS \ +# define LIBVIRT_END_ALLOW_THREADS \ if (PyEval_ThreadsInitialized()) \ PyEval_RestoreThread(_save); \ } LIBVIRT_STMT_END -#define LIBVIRT_ENSURE_THREAD_STATE \ +# define LIBVIRT_ENSURE_THREAD_STATE \ LIBVIRT_STMT_START { \ PyGILState_STATE _save = PyGILState_UNLOCKED; \ if (PyEval_ThreadsInitialized()) \ _save = PyGILState_Ensure(); -#define LIBVIRT_RELEASE_THREAD_STATE \ +# define LIBVIRT_RELEASE_THREAD_STATE \ if (PyEval_ThreadsInitialized()) \ PyGILState_Release(_save); \ } LIBVIRT_STMT_END +#else + +# define LIBVIRT_BEGIN_ALLOW_THREADS \ + LIBVIRT_STMT_START { \ + PyThreadState *_save = PyEval_SaveThread(); + +# define LIBVIRT_END_ALLOW_THREADS \ + PyEval_RestoreThread(_save); \ + } LIBVIRT_STMT_END + +# define LIBVIRT_ENSURE_THREAD_STATE \ + LIBVIRT_STMT_START { \ + PyGILState_STATE _save = PyGILState_Ensure(); + +# define LIBVIRT_RELEASE_THREAD_STATE \ + PyGILState_Release(_save); \ + } LIBVIRT_STMT_END +#endif + #ifndef NULLSTR #define NULLSTR(s) ((s) ? (s) : "<null>") #endif _______________________________________________ openSUSE Commits mailing list -- commit@lists.opensuse.org To unsubscribe, email commit-le...@lists.opensuse.org List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette List Archives: https://lists.opensuse.org/archives/list/commit@lists.opensuse.org