================
@@ -3257,21 +3323,21 @@ def reparse(self, unsaved_files=None, options=0):
         if unsaved_files is None:
             unsaved_files = []
 
-        unsaved_files_array = 0
+        unsaved_files_array: int | Array[_CXUnsavedFile] = 0
         if len(unsaved_files):
             unsaved_files_array = (_CXUnsavedFile * len(unsaved_files))()
             for i, (name, contents) in enumerate(unsaved_files):
                 if hasattr(contents, "read"):
                     contents = contents.read()
-                contents = b(contents)
+                binary_contents = b(contents)
----------------
DeinAlptraum wrote:

Assigning an incompatible type to a variable of a different type is a type 
error. Changing `binary_contents` back to `contents` produces a type error like 
this on that line:
`clang/cindex.py:3332: error: Incompatible types in assignment (expression has 
type "bytes", variable has type "str | TextIOWrapper")`
Good point with the repetition though, I'll make separate PRs for these to 
collect this into a common function.

https://github.com/llvm/llvm-project/pull/78114
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to