1 Star 0 Fork 17

yezengruan/libvirt-python

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Replace-deprecated-PyEval_CallObject-with-PyObject_C.patch 3.72 KB
一键复制 编辑 原始数据 按行查看 历史
imxcc 提交于 2022-01-11 10:49 +08:00 . spec: use pytest instead of nose
From d966561b118ce9fe159a9a47c3a120e8439004d0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Date: Thu, 12 Nov 2020 14:31:54 +0000
Subject: [PATCH 6/6] Replace deprecated PyEval_CallObject with PyObject_Call
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The former is deprecated since Python 3.9, and the latter has existed
for all 3.x and probably before.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
libvirt-override.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/libvirt-override.c b/libvirt-override.c
index 00efe7f..d1f3ac0 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -1856,7 +1856,7 @@ libvirt_virErrorFuncHandler(ATTRIBUTE_UNUSED void *ctx,
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 @@ virConnectCredCallbackWrapper(virConnectCredentialPtr cred,
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 @@ libvirt_virEventAddHandleFunc(int fd,
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 @@ libvirt_virEventUpdateHandleFunc(int watch,
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 @@ libvirt_virEventRemoveHandleFunc(int watch)
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 @@ libvirt_virEventAddTimeoutFunc(int timeout,
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 @@ libvirt_virEventUpdateTimeoutFunc(int timer,
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 @@ libvirt_virEventRemoveTimeoutFunc(int timer)
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 {
--
2.27.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yezengruan/libvirt-python.git
git@gitee.com:yezengruan/libvirt-python.git
yezengruan
libvirt-python
libvirt-python
master

搜索帮助

371d5123 14472233 46e8bd33 14472233