[gitdm PATCH 2/2] logparser.py: Try and be more robust with unicode handling

Tom Rini trini at konsulko.com
Thu Jul 7 21:22:15 CEST 2022


Given the sometimes oddly formatted data that can come through when
removing code, we need to be as flexible as possible when handling it.
Set our encoding to unicode_escape and if we still run in to a problem,
it's likely going to be OK to ignore it.

Signed-off-by: Tom Rini <trini at konsulko.com>
---
I've emailed this to Jonathan Corbet as well as he's the upstream for
the project, and this does work for me.  But I'm not a python guru by
any means.  But trying to run the stats for v2022.04..v2022.07-rc6 blows
up in places otherwise.

 logparser.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/logparser.py b/logparser.py
index efbc72f868eb..d5906e97689d 100644
--- a/logparser.py
+++ b/logparser.py
@@ -37,6 +37,7 @@ class LogPatchSplitter:
         self.fd = fd
         self.buffer = None
         self.patch = []
+        sys.stdin.reconfigure(encoding='unicode_escape', errors='ignore')
 
     def __iter__(self):
         return self
-- 
2.25.1



More information about the U-Boot mailing list