From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E3791A04F9; Thu, 16 Jan 2020 08:17:39 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C6A9A1C13B; Thu, 16 Jan 2020 08:17:39 +0100 (CET) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 207BE1C0D7 for ; Thu, 16 Jan 2020 08:17:37 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Jan 2020 23:17:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,325,1574150400"; d="scan'208";a="257050893" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga001.fm.intel.com with ESMTP; 15 Jan 2020 23:17:36 -0800 Received: from fmsmsx118.amr.corp.intel.com (10.18.116.18) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 15 Jan 2020 23:17:36 -0800 Received: from shsmsx106.ccr.corp.intel.com (10.239.4.159) by fmsmsx118.amr.corp.intel.com (10.18.116.18) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 15 Jan 2020 23:17:36 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.30]) by SHSMSX106.ccr.corp.intel.com ([169.254.10.139]) with mapi id 14.03.0439.000; Thu, 16 Jan 2020 15:17:35 +0800 From: "Tu, Lijuan" To: "Xiao, QimaiX" , "dts@dpdk.org" CC: "Xiao, QimaiX" Thread-Topic: [dts] [PATCH V1]dep/lldp: explicitly encode str to bytes in python3 Thread-Index: AQHVzDvVTCwYi5F+3kWhILqln8Y7qqfs4Ydg Date: Thu, 16 Jan 2020 07:17:34 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BBAB73E@SHSMSX101.ccr.corp.intel.com> References: <1579158326-432253-1-git-send-email-qimaix.xiao@intel.com> In-Reply-To: <1579158326-432253-1-git-send-email-qimaix.xiao@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dts] [PATCH V1]dep/lldp: explicitly encode str to bytes in python3 X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org Sender: "dts" Applied failed, please rework. > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Xiao Qimai > Sent: Thursday, January 16, 2020 3:05 PM > To: dts@dpdk.org > Cc: Xiao, QimaiX > Subject: [dts] [PATCH V1]dep/lldp: explicitly encode str to bytes in pyth= on3 >=20 > python3 will not implicitly convert bytes to str >=20 > Signed-off-by: Xiao Qimai > --- > dep/lldp.py | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/dep/lldp.py b/dep/lldp.py > index d8fabe2..faa3b4d 100644 > --- a/dep/lldp.py > +++ b/dep/lldp.py > @@ -79,7 +79,7 @@ class LLDPGeneric(Packet): > def post_build(self, p, pay): > if self.length is None: > l =3D len(p) - 2 > - p =3D chr((self.type << 1) ^ (l >> 8)) + chr(l & 0xff) + p[2= :] > + p =3D chr((self.type << 1) ^ (l >> 8)).encode() + chr(l & 0x= ff).encode() + > p[2:] >=20 > return p+pay >=20 > @@ -212,7 +212,7 @@ class LLDPManagementAddress(LLDPGeneric): > # TODO Remove redundant code. LLDPGeneric.post_build() > if self.length is None: > l =3D len(p) - 2 > - p =3D chr((self.type << 1) ^ (l >> 8)) + chr(l & 0xff) + p[2= :] > + p =3D chr((self.type << 1) ^ (l >> 8)).encode() + chr(l & 0x= ff).encode() + > p[2:] >=20 > if self.addrlen is None: > addrlen =3D len(p) - 2 - 8 - len(self.oid) + 1 > -- > 2.17.1