================
@@ -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:

There is no strict requirement for `typing_extensions` to be available, though 
all type checkers I've seen are either written in Python and depend on 
`typing_extensions` themselves  (the default checker `mypy`, Google's `pytype`, 
Facebook's `pyre`), or don't use Python at all (Microsoft's `pyright`) in which 
case the installed modules don't matter
Aside from that, as `TYPE_CHECKING` mode doesn't actually include any 
execution, the module not being installed would never lead to an error. At 
most, the type checker would complain that it can't resolve the import.

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

Reply via email to