Skip to content

Commit 82eee26

Browse files
authored
[libclang/python] Fix Type.get_offset annotation (#187841)
As discussed in #180876 (comment), `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.
1 parent 4d058ae commit 82eee26

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

clang/bindings/python/clang/cindex.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2919,7 +2919,7 @@ def get_size(self) -> int:
29192919
"""
29202920
return conf.lib.clang_Type_getSizeOf(self) # type: ignore [no-any-return]
29212921

2922-
def get_offset(self, fieldname: str) -> int:
2922+
def get_offset(self, fieldname: TUnion[str, bytes]) -> int:
29232923
"""
29242924
Retrieve the offset of a field in the record.
29252925
"""

0 commit comments

Comments
 (0)