[libclang/python] Fix Type.get_offset annotation#187841
Merged
DeinAlptraum merged 1 commit intollvm:mainfrom Mar 21, 2026
Merged
[libclang/python] Fix Type.get_offset annotation#187841DeinAlptraum merged 1 commit intollvm:mainfrom
DeinAlptraum merged 1 commit intollvm:mainfrom
Conversation
Member
|
@llvm/pr-subscribers-clang Author: Jannick Kremer (DeinAlptraum) ChangesAs discussed in #180876 (comment), 1 Files Affected:
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.
"""
|
Endilll
approved these changes
Mar 21, 2026
ambergorzynski
pushed a commit
to ambergorzynski/llvm-project
that referenced
this pull request
Mar 27, 2026
As discussed in llvm#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.
Aadarsh-Keshri
pushed a commit
to Aadarsh-Keshri/llvm-project
that referenced
this pull request
Mar 28, 2026
As discussed in llvm#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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As discussed in #180876 (comment),
Type.get_offsetcan processbytesarguments as well. For consistency with other functions takingstrarguments, its type annotation is adapted to reflect this.