[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.
This commit is contained in:
Jannick Kremer 2026-03-21 23:51:56 +09:00 committed by GitHub
parent 4d058aeb08
commit 82eee26ccc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2919,7 +2919,7 @@ class Type(Structure):
"""
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.
"""