[PATCH] D71746: Fix the "TypeError: a bytes-like object is required, not 'str'" in exploded-graph-rewriter.py on Python 3.5+

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Dec 21 11:05:02 PST 2019


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2203089a60d8: [analyzer] exploded-graph-rewriter: Fix string encodings in python3. (authored by dergachev.a).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71746/new/

https://reviews.llvm.org/D71746

Files:
  clang/utils/analyzer/exploded-graph-rewriter.py


Index: clang/utils/analyzer/exploded-graph-rewriter.py
===================================================================
--- clang/utils/analyzer/exploded-graph-rewriter.py
+++ clang/utils/analyzer/exploded-graph-rewriter.py
@@ -18,6 +18,7 @@
 import logging
 import os
 import re
+import sys
 
 
 #===-----------------------------------------------------------------------===#
@@ -425,7 +426,10 @@
 
     def output(self):
         assert not self._dump_dot_only
-        return ''.join(self._output)
+        if sys.version_info[0] > 2 and sys.version_info[1] >= 5:
+            return ''.join(self._output).encode()
+        else:
+            return ''.join(self._output)
 
     def _dump(self, s):
         s = s.replace('&', '&') \


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71746.235023.patch
Type: text/x-patch
Size: 744 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191221/cf4ada07/attachment.bin>


More information about the cfe-commits mailing list