From 4099aec69a3ccc9aeb86e81cd5c389a69688a39b Mon Sep 17 00:00:00 2001 From: fumihiko kakuma Date: Mon, 29 Jun 2015 16:00:57 +0900 Subject: [PATCH] python3: Modify a literal argument in a bytes method call to bytes type Signed-off-by: Fumihiko Kakuma Signed-off-by: FUJITA Tomonori --- ryu/ofproto/ofproto_v1_2_parser.py | 6 +++--- ryu/tests/unit/ofproto/test_parser_v12.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ryu/ofproto/ofproto_v1_2_parser.py b/ryu/ofproto/ofproto_v1_2_parser.py index 7ecce123..b528181f 100644 --- a/ryu/ofproto/ofproto_v1_2_parser.py +++ b/ryu/ofproto/ofproto_v1_2_parser.py @@ -333,7 +333,7 @@ class OFPPort(ofproto_parser.namedtuple('OFPPort', ( i = cls._fields.index('hw_addr') port[i] = addrconv.mac.bin_to_text(port[i]) i = cls._fields.index('name') - port[i] = port[i].rstrip('\0') + port[i] = port[i].rstrip(b'\0') return cls(*port) @@ -1985,7 +1985,7 @@ class OFPDescStats(ofproto_parser.namedtuple('OFPDescStats', ( desc = struct.unpack_from(ofproto.OFP_DESC_STATS_PACK_STR, buf, offset) desc = list(desc) - desc = [x.rstrip('\0') for x in desc] + desc = [x.rstrip(b'\0') for x in desc] stats = cls(*desc) stats.length = ofproto.OFP_DESC_STATS_SIZE return stats @@ -2375,7 +2375,7 @@ class OFPTableStats( buf, offset) table = list(table) i = cls._fields.index('name') - table[i] = table[i].rstrip('\0') + table[i] = table[i].rstrip(b'\0') stats = cls(*table) stats.length = ofproto.OFP_TABLE_STATS_SIZE return stats diff --git a/ryu/tests/unit/ofproto/test_parser_v12.py b/ryu/tests/unit/ofproto/test_parser_v12.py index ccffcac4..f3645bdb 100644 --- a/ryu/tests/unit/ofproto/test_parser_v12.py +++ b/ryu/tests/unit/ofproto/test_parser_v12.py @@ -4985,7 +4985,7 @@ class TestOFPTableStats(unittest.TestCase): res = OFPTableStats.parser(buf, 0) eq_(table_id, res.table_id) - eq_(name, res.name.replace(b'\x00', '')) + eq_(name, res.name.replace(b'\x00', b'')) eq_(match, res.match) eq_(wildcards, res.wildcards) eq_(write_actions, res.write_actions)