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

Jannick Kremer via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 6 04:02:10 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
----------------
DeinAlptraum wrote:

Yes that's right, that's why I put this inside the `if TYPE_CHECKING` guard: this line will only be executed on a type checker run, so it does not affect normal usage at all. The CI would fail otherwise, and in fact, did, before I moved this inside that block.
Does this still need a release note in that case?

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


More information about the cfe-commits mailing list