libteam/SOURCES/libteam-binding-python-use-SWIG_FromCharPtrAndSize-for-Pytho.patch
2021-09-09 21:04:01 +00:00

35 lines
1.4 KiB
Diff

From d9769b270608654aa7f07ce48a36f084843daf01 Mon Sep 17 00:00:00 2001
Message-Id: <d9769b270608654aa7f07ce48a36f084843daf01.1533278517.git.lucien.xin@gmail.com>
From: Xin Long <lucien.xin@gmail.com>
Date: Wed, 25 Jul 2018 16:43:22 +0800
Subject: [PATCHv2 1/2] binding/python: use SWIG_FromCharPtrAndSize for Python3
support
PyString_FromStringAndSize is replaced with PyUnicode_FromStringAndSize
in Python3, and SWIG_FromCharPtrAndSize will choose the right one with
the check "#if PY_VERSION_HEX >= 0x0300000".
Fixes: 4cb7829debd7 ("add support for hw address manipulation")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
binding/python/team/capi.i.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/binding/python/team/capi.i.in b/binding/python/team/capi.i.in
index 5ce4659..c7a5842 100644
--- a/binding/python/team/capi.i.in
+++ b/binding/python/team/capi.i.in
@@ -40,7 +40,7 @@ int team_hwaddr_set(struct team_handle *th, uint32_t ifindex, const char *addr,
if ($1) free($1);
}
%typemap(argout) (char *addr, unsigned int addr_len) {
- $result = SWIG_Python_AppendOutput($result, PyString_FromStringAndSize($1,$2));
+ $result = SWIG_Python_AppendOutput($result, SWIG_FromCharPtrAndSize($1,$2));
}
%apply char *OUTPUT {char *addr};
int team_hwaddr_get(struct team_handle *th, uint32_t ifindex, char *addr, unsigned int addr_len);
--
2.1.0