[clang] [libclang/python] Add typing annotations for the Cursor class (PR #138103)

Jannick Kremer via cfe-commits cfe-commits at lists.llvm.org
Thu May 15 23:09:04 PDT 2025


================
@@ -1552,68 +1553,85 @@ class Cursor(Structure):
 
     _fields_ = [("_kind_id", c_int), ("xdata", c_int), ("data", c_void_p * 3)]
 
+    _tu: TranslationUnit
+
+    # This ensures that no operations are possible on null cursors
+    # by guarding all method calls with a not-null assert
+    def __getattribute__(self, key: str) -> object:
----------------
DeinAlptraum wrote:

Okay, added comments on `__eq__`, `__ne__` and `is_null` 

https://github.com/llvm/llvm-project/pull/138103


More information about the cfe-commits mailing list