BaseTools: Explicitly close files after readlines
Rework some file open().readlines to open, readlines, close. This prevents excessive file handles being open at the same time, which may be a problem with alternative python environments. Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Michael Johnson <michael.johnson@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
This commit is contained in:
@ -34,7 +34,8 @@ class InfSectionParser():
|
||||
SectionData = []
|
||||
|
||||
try:
|
||||
FileLinesList = open(self._FilePath, "r").readlines()
|
||||
with open(self._FilePath, "r") as File:
|
||||
FileLinesList = File.readlines()
|
||||
except BaseException:
|
||||
EdkLogger.error("build", AUTOGEN_ERROR, 'File %s is opened failed.' % self._FilePath)
|
||||
|
||||
|
Reference in New Issue
Block a user