[U-Boot] [PATCH 09/24] dtoc: Use binary mode for reading files

Simon Glass sjg at chromium.org
Sat May 18 04:00:39 UTC 2019


The .dtb files are binary so we should open them as binary files. This
allows Python 3 to use the correct 'bytes' type.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 tools/dtoc/test_fdt.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py
index 3cd34b745ed..4c39f9a3e28 100755
--- a/tools/dtoc/test_fdt.py
+++ b/tools/dtoc/test_fdt.py
@@ -85,13 +85,13 @@ class TestFdt(unittest.TestCase):
     def testFlush(self):
         """Check that we can flush the device tree out to its file"""
         fname = self.dtb._fname
-        with open(fname) as fd:
+        with open(fname, 'rb') as fd:
             data = fd.read()
         os.remove(fname)
         with self.assertRaises(IOError):
-            open(fname)
+            open(fname, 'rb')
         self.dtb.Flush()
-        with open(fname) as fd:
+        with open(fname, 'rb') as fd:
             data = fd.read()
 
     def testPack(self):
-- 
2.21.0.1020.gf2820cf01a-goog



More information about the U-Boot mailing list