代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/libvirt-python 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From ccbe311a4bcb123933499126278ba48aab36427a Mon Sep 17 00:00:00 2001
From: Cole Robinson <crobinso@redhat.com>
Date: Sun, 5 Jul 2020 12:51:45 -0400
Subject: [PATCH 4/6] Fix PY_SSIZE_T_CLEAN deprecation warning
Seen running on fedora 32:
DeprecationWarning: PY_SSIZE_T_CLEAN will be required for '#' formats
ret = libvirtmod.virDomainLookupByUUID(self._o, uuid)
This comes from here: https://bugs.python.org/issue36381
See the section about PY_SSIZE_T_CLEAN here:
https://docs.python.org/3/c-api/arg.html#strings-and-buffers
Solution is to use Py_ssize_t instead of int for unpacked '#' values,
combined with defined PY_SSIZE_T_CLEAN before importing Python.h. The
latter turns these deprecation warnings into runtime segfaults though
if we missed an instance.
I verified the virt-manager's test suite works fine after this change
Signed-off-by: Cole Robinson <crobinso@redhat.com>
---
libvirt-override.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/libvirt-override.c b/libvirt-override.c
index 2b39ace..00efe7f 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -17,6 +17,7 @@
/* We want to see *_LAST enums. */
#define VIR_ENUM_SENTINELS
+#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <libvirt/libvirt.h>
#include <libvirt/virterror.h>
@@ -3040,7 +3041,7 @@ libvirt_virDomainLookupByUUID(PyObject *self ATTRIBUTE_UNUSED,
virConnectPtr conn;
PyObject *pyobj_conn;
unsigned char * uuid;
- int len;
+ Py_ssize_t len;
if (!PyArg_ParseTuple(args, (char *)"Oz#:virDomainLookupByUUID",
&pyobj_conn, &uuid, &len))
@@ -3283,7 +3284,7 @@ libvirt_virNetworkLookupByUUID(PyObject *self ATTRIBUTE_UNUSED,
virConnectPtr conn;
PyObject *pyobj_conn;
unsigned char * uuid;
- int len;
+ Py_ssize_t len;
if (!PyArg_ParseTuple(args, (char *)"Oz#:virNetworkLookupByUUID",
&pyobj_conn, &uuid, &len))
@@ -3992,7 +3993,7 @@ libvirt_virStoragePoolLookupByUUID(PyObject *self ATTRIBUTE_UNUSED,
virConnectPtr conn;
PyObject *pyobj_conn;
unsigned char * uuid;
- int len;
+ Py_ssize_t len;
if (!PyArg_ParseTuple(args, (char *)"Oz#:virStoragePoolLookupByUUID",
&pyobj_conn, &uuid, &len))
@@ -4233,7 +4234,7 @@ libvirt_virSecretLookupByUUID(PyObject *self ATTRIBUTE_UNUSED,
virConnectPtr conn;
PyObject *pyobj_conn;
unsigned char * uuid;
- int len;
+ Py_ssize_t len;
if (!PyArg_ParseTuple(args, (char *)"Oz#:virSecretLookupByUUID",
&pyobj_conn, &uuid, &len))
@@ -4393,7 +4394,7 @@ libvirt_virSecretSetValue(PyObject *self ATTRIBUTE_UNUSED,
virSecretPtr secret;
PyObject *pyobj_secret;
const char *value;
- int size;
+ Py_ssize_t size;
unsigned int flags;
if (!PyArg_ParseTuple(args, (char *)"Oz#I:virSecretSetValue", &pyobj_secret,
@@ -4402,8 +4403,8 @@ libvirt_virSecretSetValue(PyObject *self ATTRIBUTE_UNUSED,
secret = (virSecretPtr) PyvirSecret_Get(pyobj_secret);
LIBVIRT_BEGIN_ALLOW_THREADS;
- c_retval = virSecretSetValue(secret, (const unsigned char *)value, size,
- flags);
+ c_retval = virSecretSetValue(secret, (const unsigned char *)value,
+ (size_t) size, flags);
LIBVIRT_END_ALLOW_THREADS;
return libvirt_intWrap(c_retval);
@@ -4471,7 +4472,7 @@ libvirt_virNWFilterLookupByUUID(PyObject *self ATTRIBUTE_UNUSED,
virConnectPtr conn;
PyObject *pyobj_conn;
unsigned char * uuid;
- int len;
+ Py_ssize_t len;
if (!PyArg_ParseTuple(args, (char *)"Oz#:virNWFilterLookupByUUID",
&pyobj_conn, &uuid, &len))
@@ -10247,7 +10248,7 @@ libvirt_virNetworkPortLookupByUUID(PyObject *self ATTRIBUTE_UNUSED,
virNetworkPtr net;
PyObject *pyobj_net;
unsigned char *uuid;
- int len;
+ Py_ssize_t len;
if (!PyArg_ParseTuple(args, (char *)"Oz#:virNetworkPortLookupByUUID",
&pyobj_net, &uuid, &len))
--
2.27.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。