https://github.com/DeinAlptraum created 
https://github.com/llvm/llvm-project/pull/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.

>From 799c287e8c1b88474a79c3579503648aae8e049e Mon Sep 17 00:00:00 2001
From: Jannick Kremer <[email protected]>
Date: Sat, 21 Mar 2026 13:58:20 +0900
Subject: [PATCH] [libclang/python] Fix Type.get_offset annotation

---
 clang/bindings/python/clang/cindex.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/bindings/python/clang/cindex.py 
b/clang/bindings/python/clang/cindex.py
index c34a1c0db01e9..57e1855886b8b 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