From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 5568074003A for ; Tue, 31 Oct 2023 20:10:44 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=vLQpWPeEeVrkDpxuWEHnmjYbPAe9z+dvkU6uJLVTHpg=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1698783042; v=1; b=RPU95Tuk9YO9Kv7vbSOVM9bWWu5HvCyeBhvnriLCJ5cehmNwa7lcL3ouwC3fUNdmuTWE/+DG FlaweCVsKZPfjhy2oPD775p/WTvY5yGQtZaqZzLOqBU88K6+Bfd82hkuPyoaQ8/fURrrW+FtFNW uaEOrf9NZOxXnW/Yd2KoAZ3k= X-Received: by 127.0.0.2 with SMTP id p6MSYY7687511xU0mEJv34UI; Tue, 31 Oct 2023 13:10:42 -0700 X-Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) by mx.groups.io with SMTP id smtpd.web10.5801.1698783042338044532 for ; Tue, 31 Oct 2023 13:10:42 -0700 X-Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-6bd0e1b1890so5082655b3a.3 for ; Tue, 31 Oct 2023 13:10:42 -0700 (PDT) X-Gm-Message-State: w10auUL0lYj5KcdH1JLCEhJKx7686176AA= X-Google-Smtp-Source: AGHT+IHqhbvKpOR0/lgGGI2Gsp4KF/m2lN5hK4eb44itR60/5PBM9IZhQeisq2hspzR42UM63F8P3Q== X-Received: by 2002:a05:6a20:430d:b0:171:a2df:4e68 with SMTP id h13-20020a056a20430d00b00171a2df4e68mr13745642pzk.36.1698783041325; Tue, 31 Oct 2023 13:10:41 -0700 (PDT) X-Received: from localhost.localdomain ([131.107.8.38]) by smtp.googlemail.com with ESMTPSA id a14-20020a170902ecce00b001bc676df6a9sm1680432plh.132.2023.10.31.13.10.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 13:10:39 -0700 (PDT) From: "Joey Vagedes via groups.io" X-Google-Original-From: Joey Vagedes To: devel@edk2.groups.io Cc: Rebecca Cran , Liming Gao , Bob Feng , Yuwei Chen Subject: [edk2-devel] [PATCH v1 1/1] BaseTools: Resolve invalid escape sequence Date: Mon, 30 Oct 2023 23:23:49 -0700 Message-Id: <20231031062349.171749-1-joeyvagedes@microsoft.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,joeyvagedes@microsoft.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=RPU95Tuk; dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io Resolves an invalid escape sequence in a regex string that occurs because the string was not marked as a raw string, so backslash characters create unexpected escape sequences. This was brought to light due to Python 3.12 now detecting invalid escape sequences and generates a warning. It is best practice to always use raw strings for regex strings. Cc: Rebecca Cran Cc: Liming Gao Cc: Bob Feng Cc: Yuwei Chen Signed-off-by: Joey Vagedes --- BaseTools/Scripts/BinToPcd.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/BaseTools/Scripts/BinToPcd.py b/BaseTools/Scripts/BinToPcd.py index 460c08b7f7cd..43fc458b0426 100644 --- a/BaseTools/Scripts/BinToPcd.py +++ b/BaseTools/Scripts/BinToPcd.py @@ -10,13 +10,12 @@ BinToPcd '''=0D from __future__ import print_function=0D =0D -import sys=0D import argparse=0D -import re=0D -import xdrlib=0D import io=0D -import struct=0D import math=0D +import re=0D +import struct=0D +import sys=0D =0D #=0D # Globals for help information=0D @@ -38,13 +37,13 @@ if __name__ =3D=3D '__main__': return Value=0D =0D def ValidatePcdName (Argument):=0D - if re.split ('[a-zA-Z\_][a-zA-Z0-9\_]*\.[a-zA-Z\_][a-zA-Z0-9\_]*',= Argument) !=3D ['', '']:=0D + if re.split (r'[a-zA-Z\_][a-zA-Z0-9\_]*\.[a-zA-Z\_][a-zA-Z0-9\_]*'= , Argument) !=3D ['', '']:=0D Message =3D '{Argument} is not in the form .'.format (Argument =3D Argument)=0D raise argparse.ArgumentTypeError (Message)=0D return Argument=0D =0D def ValidateGuidName (Argument):=0D - if re.split ('[a-zA-Z\_][a-zA-Z0-9\_]*', Argument) !=3D ['', '']:= =0D + if re.split (r'[a-zA-Z\_][a-zA-Z0-9\_]*', Argument) !=3D ['', '']:= =0D Message =3D '{Argument} is not a valid GUID C name'.format (Ar= gument =3D Argument)=0D raise argparse.ArgumentTypeError (Message)=0D return Argument=0D --=20 2.34.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#110448): https://edk2.groups.io/g/devel/message/110448 Mute This Topic: https://groups.io/mt/102305837/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-