[clang] [clang-bindings] Add strict typing to clang Python bindings (#76664) (PR #78114)
Jannick Kremer via cfe-commits
cfe-commits at lists.llvm.org
Sun Jan 14 13:58:03 PST 2024
================
@@ -2341,30 +2830,32 @@ class Type(Structure):
_fields_ = [("_kind_id", c_int), ("data", c_void_p * 2)]
+ _tu: TranslationUnit
+
@property
- def kind(self):
+ def kind(self) -> TypeKind:
"""Return the kind of this type."""
return TypeKind.from_id(self._kind_id)
- def argument_types(self):
+ def argument_types(self) -> NoSliceSequence[Type]:
"""Retrieve a container for the non-variadic arguments for this type.
The returned object is iterable and indexable. Each item in the
container is a Type instance.
"""
- class ArgumentsIterator(collections_abc.Sequence):
- def __init__(self, parent):
+ class ArgumentsIterator:
----------------
DeinAlptraum wrote:
Removed the inheritance here, since ArgumentsIterator doesn't actually implement everything needed by the protocol anyway (which is precisely why I had to add the `NoSliceSequence` protocol)
https://github.com/llvm/llvm-project/pull/78114
More information about the cfe-commits
mailing list