bdcht created this revision.
bdcht added a reviewer: clang.
bdcht added a project: clang.
Herald added a subscriber: cfe-commits.
In method 'reparse' of the python bindings (cindex.py), a TypeError is raised
when 'unsaved_files_array' is set from name/value arguments when using Python3.
(This is due to Python3 mess with bytes vs unicode str...)
The way this unsaved_files_array is set here is not consistent with similar
code in other methods like 'from_source' or 'codeComplete'. This proposed fix
just
replicates what is done in from_source/codeComplete to set this ctypes
unsaved_files_array.
Repository:
rC Clang
https://reviews.llvm.org/D52173
Files:
bindings/python/clang/cindex.py
Index: bindings/python/clang/cindex.py
===
--- bindings/python/clang/cindex.py
+++ bindings/python/clang/cindex.py
@@ -2983,8 +2983,8 @@
print(value)
if not isinstance(value, str):
raise TypeError('Unexpected unsaved file contents.')
-unsaved_files_array[i].name = name
-unsaved_files_array[i].contents = value
+unsaved_files_array[i].name = b(name)
+unsaved_files_array[i].contents = b(value)
unsaved_files_array[i].length = len(value)
ptr = conf.lib.clang_reparseTranslationUnit(self, len(unsaved_files),
unsaved_files_array, options)
Index: bindings/python/clang/cindex.py
===
--- bindings/python/clang/cindex.py
+++ bindings/python/clang/cindex.py
@@ -2983,8 +2983,8 @@
print(value)
if not isinstance(value, str):
raise TypeError('Unexpected unsaved file contents.')
-unsaved_files_array[i].name = name
-unsaved_files_array[i].contents = value
+unsaved_files_array[i].name = b(name)
+unsaved_files_array[i].contents = b(value)
unsaved_files_array[i].length = len(value)
ptr = conf.lib.clang_reparseTranslationUnit(self, len(unsaved_files),
unsaved_files_array, options)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits