================
@@ -1763,19 +1799,22 @@ def get_usr(self):
         another translation unit."""
         return _CXString.from_result(conf.lib.clang_getCursorUSR(self))
 
-    def get_included_file(self):
+    @cursor_null_guard
+    def get_included_file(self) -> File:
         """Returns the File that is included by the current inclusion 
cursor."""
         assert self.kind == CursorKind.INCLUSION_DIRECTIVE
 
         return File.from_result(conf.lib.clang_getIncludedFile(self), self)
 
     @property
-    def kind(self):
+    @cursor_null_guard
----------------
DeinAlptraum wrote:

The decorator isn't removed. You can chain decorators in Python as
```python
@decorator2
@decorator1
def myfunc(...):
```
where the bottom decorator (in this case `cursor_null_guard`) wraps the 
function first, followed by the top decorator (`property`)

`kind` is used extensively as property in the tests, see for example in 
[test_cursor.py](https://github.com/llvm/llvm-project/blob/main/clang/bindings/python/tests/cindex/test_cursor.py)
 about 50 times

https://github.com/llvm/llvm-project/pull/138103
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to