Message ID | 980c3871de3f9a4b0e85f4f7888661e7330b6380.1532508202.git.lucien.xin@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | binding/python: use SWIG_FromCharPtrAndSize for Python3 support | expand |
Wed, Jul 25, 2018 at 10:43:22AM CEST, lucien.xin@gmail.com wrote: >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> applied, thanks!
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);
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> --- binding/python/team/capi.i.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)