Author: Jannick Kremer
Date: 2026-03-21T23:51:56+09:00
New Revision: 82eee26ccccd3d139bad649376ef56fb8bf28e83

URL: 
https://github.com/llvm/llvm-project/commit/82eee26ccccd3d139bad649376ef56fb8bf28e83
DIFF: 
https://github.com/llvm/llvm-project/commit/82eee26ccccd3d139bad649376ef56fb8bf28e83.diff

LOG: [libclang/python] Fix Type.get_offset annotation (#187841)

As discussed in
https://github.com/llvm/llvm-project/pull/180876#discussion_r2934372753,
`Type.get_offset` can process `bytes` arguments as well. For consistency
with other functions taking `str` arguments, its type annotation is
adapted to reflect this.

Added: 
    

Modified: 
    clang/bindings/python/clang/cindex.py

Removed: 
    


################################################################################
diff  --git a/clang/bindings/python/clang/cindex.py 
b/clang/bindings/python/clang/cindex.py
index 48b3f5bfef6b6..6e8ea782df74c 100644
--- a/clang/bindings/python/clang/cindex.py
+++ b/clang/bindings/python/clang/cindex.py
@@ -2919,7 +2919,7 @@ def get_size(self) -> int:
         """
         return conf.lib.clang_Type_getSizeOf(self)  # type: ignore 
[no-any-return]
 
-    def get_offset(self, fieldname: str) -> int:
+    def get_offset(self, fieldname: TUnion[str, bytes]) -> int:
         """
         Retrieve the offset of a field in the record.
         """


        
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to