[clang] [libclang/python] Fix some type errors, add type annotations (PR #98745)

Vlad Serebrennikov via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 6 03:52:14 PDT 2024


================
@@ -64,48 +64,80 @@
 
 from ctypes import *
 
-import collections.abc
 import os
+import sys
 from enum import Enum
 
+from typing import (
+    Any,
+    Callable,
+    Generic,
+    Optional,
+    Type as TType,
+    TypeVar,
+    TYPE_CHECKING,
+    Union as TUnion,
+)
+
+if TYPE_CHECKING:
+    from ctypes import _Pointer
+    from typing_extensions import Protocol, TypeAlias
----------------
Endilll wrote:

IIRC `typing_extensions` are not in the Python standard library, and we didn't use them before. Which make them a novel dependency. At the very least this should be mentioned in the release notes. Otherwise I'm not sure how `cindex.py` appears on users' systems, or whether we maintain an official package with a list of dependencies.

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


More information about the cfe-commits mailing list