]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: Avoid "is" with a literal Python 3.8 warnings
authorPhilippe Mathieu-Daude <philmd@redhat.com>
Thu, 5 Dec 2019 11:19:41 +0000 (19:19 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Fri, 6 Dec 2019 03:07:37 +0000 (03:07 +0000)
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2304

The following statement produces a SyntaxWarning with Python 3.8:

  if str(FdRegion.RegionType) is 'FILE' and self.Platform.VpdToolGuid in \
    str(FdRegion.RegionDataList):
  BaseTools/Source/Python/AutoGen/WorkspaceAutoGen.py:168: SyntaxWarning: \
    "is" with a literal. Did you mean "=="?

Change the 'is' operator by the conventional '==' comparator.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
BaseTools/Source/Python/AutoGen/WorkspaceAutoGen.py

index fde48b4b2788f2c7240aa27a9cd854acd8a84904..ec0c25bd1487e7d426d6c4b9fca121137ed6ed4c 100644 (file)
@@ -165,7 +165,7 @@ class WorkspaceAutoGen(AutoGen):
             if Fdf.CurrentFdName and Fdf.CurrentFdName in Fdf.Profile.FdDict:\r
                 FdDict = Fdf.Profile.FdDict[Fdf.CurrentFdName]\r
                 for FdRegion in FdDict.RegionList:\r
-                    if str(FdRegion.RegionType) is 'FILE' and self.Platform.VpdToolGuid in str(FdRegion.RegionDataList):\r
+                    if str(FdRegion.RegionType) == 'FILE' and self.Platform.VpdToolGuid in str(FdRegion.RegionDataList):\r
                         if int(FdRegion.Offset) % 8 != 0:\r
                             EdkLogger.error("build", FORMAT_INVALID, 'The VPD Base Address %s must be 8-byte aligned.' % (FdRegion.Offset))\r
             FdfProfile = Fdf.Profile\r