From 3780744968f0b26cc2f4fea61a0cc594da6fa616 Mon Sep 17 00:00:00 2001 From: Ross Burton Date: Fri, 13 Dec 2019 11:33:51 +0000 Subject: chrpath: Cleanup and fix previous patch Ensure self.data isn't accessed without assignment. Also clean up old style popen use and replace with modern/simpler subprocess. (From OE-Core rev: 39825cba4761a6b4b2473825705975f9f421ec8b) Signed-off-by: Richard Purdie --- meta/lib/oe/qa.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'meta/lib') diff --git a/meta/lib/oe/qa.py b/meta/lib/oe/qa.py index 21066c4dc3..ea831b930a 100644 --- a/meta/lib/oe/qa.py +++ b/meta/lib/oe/qa.py @@ -41,13 +41,15 @@ class ELFFile: def __init__(self, name): self.name = name self.objdump_output = {} + self.data = None # Context Manager functions to close the mmap explicitly def __enter__(self): return self def __exit__(self, exc_type, exc_value, traceback): - self.data.close() + if self.data: + self.data.close() def open(self): with open(self.name, "rb") as f: -- cgit v1.2.3-54-g00ecf