[clang] [libclang/python] Add some logical typing changes. (PR #138074)

Vlad Serebrennikov via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 30 20:12:02 PDT 2025


================
@@ -3466,6 +3479,8 @@ def get_tokens(self, locations=None, extent=None):
         """
         if locations is not None:
             extent = SourceRange(start=locations[0], end=locations[1])
+        if extent is None:
+            raise TypeError("get_tokens() requires at least one argument")
----------------
Endilll wrote:

Can you move this check up, and test both arguments for None? I don't like how it depends on the previous `if` to work.

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


More information about the cfe-commits mailing list