From patchwork Wed Jul 25 08:43:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xin Long X-Patchwork-Id: 10543705 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6B0B3139A for ; Wed, 25 Jul 2018 08:43:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 567BD28E2A for ; Wed, 25 Jul 2018 08:43:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4AC3E29B8B; Wed, 25 Jul 2018 08:43:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from bastion.fedoraproject.org (bastion01.fedoraproject.org [209.132.181.2]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3A67228E2A for ; Wed, 25 Jul 2018 08:43:35 +0000 (UTC) Received: from mailman01.phx2.fedoraproject.org (mailman01.phx2.fedoraproject.org [10.5.126.36]) by bastion01.phx2.fedoraproject.org (Postfix) with ESMTP id 874B0625909C; Wed, 25 Jul 2018 08:43:34 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 bastion01.phx2.fedoraproject.org 874B0625909C Received: from mailman01.phx2.fedoraproject.org (localhost [IPv6:::1]) by mailman01.phx2.fedoraproject.org (Postfix) with ESMTP id 6E1A721B552FE; Wed, 25 Jul 2018 08:43:34 +0000 (UTC) Received: by mailman01.phx2.fedoraproject.org (Postfix, from userid 991) id 28F8421B552FA; Wed, 25 Jul 2018 08:43:31 +0000 (UTC) Received: from smtp-mm-osuosl01.fedoraproject.org (smtp-mm-osuosl01.vpn.fedoraproject.org [192.168.1.23]) by mailman01.phx2.fedoraproject.org (Postfix) with ESMTP id A22C521B552FA for ; Wed, 25 Jul 2018 08:43:30 +0000 (UTC) Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by smtp-mm-osuosl01.fedoraproject.org (Postfix) with ESMTPS id 6496A981CF for ; Wed, 25 Jul 2018 08:43:30 +0000 (UTC) Received: by mail-pg1-x542.google.com with SMTP id f1-v6so4832653pgq.12 for ; Wed, 25 Jul 2018 01:43:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=enyuFZY98ADvra5pQqlEAEUZHcU+qdmtsGGTC0e5aAU=; b=NWEUCTQNXROxTgY6/GzzoH0iy5D+2xWcvjbvSVn9IBFD3vl+F+VPMtwRQt+JWt6s9m 2AoXOmz7DUX0TjS/wrYaOUxbSbaiatkAwOCLGF8mI47vUXxmAfRkdTtR6pDtztlN4qDd zsEkDt09bupcELwZrGfO1kJB+lzpDDcbAdsRRPTYQM8Zg0GXGCvcgDsQlQ2/m6Vfwk// XTqKk1/HTu/lMDsTLiWf2bb6IfA+0WmEVP9rH955W68NfLH7k05J9AJv25G9e/oxE7Ai Pc8byjmRnHO/bR1RjnZRhdBu7EExFPm4NFach4YVRSaMXOZzcxPOlaHoBFfMPQ4Dt1TN 5fTw== X-Gm-Message-State: AOUpUlEcRLppQzRHUNjr7LQwgfh541yHoCb3TKgCyFsZZStGeFgvI/RG iVH+71TOHtlcB14a/A2XXo1oxR5h X-Google-Smtp-Source: AAOMgpeoz1mw10TzBdv9T+PHlav0TEXBVhBPpT/XZ98CcJesuYilutmwBsPo0GAWZjHoH3Qn2/IvPA== X-Received: by 2002:a63:5463:: with SMTP id e35-v6mr19893114pgm.115.1532508209851; Wed, 25 Jul 2018 01:43:29 -0700 (PDT) Received: from localhost ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id 14-v6sm23308093pft.93.2018.07.25.01.43.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Jul 2018 01:43:29 -0700 (PDT) From: Xin Long To: libteam@lists.fedorahosted.org Subject: [PATCH] binding/python: use SWIG_FromCharPtrAndSize for Python3 support Date: Wed, 25 Jul 2018 16:43:22 +0800 Message-Id: <980c3871de3f9a4b0e85f4f7888661e7330b6380.1532508202.git.lucien.xin@gmail.com> X-Mailer: git-send-email 2.1.0 Message-ID-Hash: 77ZQXGDW2WSJJDVHK4MMCCZN3MMLMQXE X-Message-ID-Hash: 77ZQXGDW2WSJJDVHK4MMCCZN3MMLMQXE X-MailFrom: lucien.xin@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: Jiri Pirko X-Mailman-Version: 3.1.1 Precedence: list List-Id: Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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);