From eb4a4b88d19cc2563d9bb4ba9ff1e13cc3758a76 Mon Sep 17 00:00:00 2001 From: Phil Ramsey Date: Mon, 16 Dec 2024 12:32:22 +0000 Subject: [PATCH] i#2626 a64 decoder: escape sequences in codec.py rejected by Python 3.12 (#7130) Python 3.12 is strict about escape characters - '\\^' is not a valid escape sequence. Add the 'r' prefix to strings containing '\\^' so they are treated as raw strings. Issue: #2626 --- core/ir/aarch64/codec.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/ir/aarch64/codec.py b/core/ir/aarch64/codec.py index cf318d7998b..1811ed86207 100755 --- a/core/ir/aarch64/codec.py +++ b/core/ir/aarch64/codec.py @@ -561,9 +561,9 @@ def read_codec_file(path): # Syntax: pattern opcode opndtype* : opndtype* pattern, nzcv_rw_flag, enum, feat, opcode, args = line.split(None, 5) dsts, srcs = [a.split() for a in args.split(':')] - opcode_bits = int(re.sub('[\^x]', '0', pattern), 2) - opnd_bits = int(re.sub('x', '1', re.sub('[1\^]', '0', pattern)), 2) - high_soft_bits = int(re.sub('\^', '1', re.sub('[10x]', '0', pattern)), 2) + opcode_bits = int(re.sub(r'[\^x]', '0', pattern), 2) + opnd_bits = int(re.sub('x', '1', re.sub(r'[1\^]', '0', pattern)), 2) + high_soft_bits = int(re.sub(r'\^', '1', re.sub('[10x]', '0', pattern)), 2) patterns.append(Pattern(pattern, opcode_bits, opnd_bits, high_soft_bits, opcode, (dsts, srcs), enum, feat)) opc_props[opcode] = Opcode(opcode, nzcv_rw_flag, feat) continue @@ -572,7 +572,7 @@ def read_codec_file(path): pattern, nzcv_rw_flag, enum, feat, opcode, opndset = line.split() opcode_bits = int(re.sub('x', '0', pattern), 2) opnd_bits = int(re.sub('x', '1', re.sub('1', '0', pattern)), 2) - high_soft_bits = int(re.sub('\^', '1', re.sub('[10x]', '0', pattern)), 2) + high_soft_bits = int(re.sub(r'\^', '1', re.sub('[10x]', '0', pattern)), 2) patterns.append(Pattern(pattern, opcode_bits, opnd_bits, high_soft_bits, opcode, opndset, enum, feat)) opc_props[opcode] = Opcode(opcode, nzcv_rw_flag, feat) continue