mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-27 13:22:11 +08:00
Use PEP 604 syntax wherever possible (#7493)
This commit is contained in:
@@ -134,12 +134,12 @@ class _CArgObject: ...
|
||||
|
||||
# Any type that can be implicitly converted to c_void_p when passed as a C function argument.
|
||||
# (bytes is not included here, see below.)
|
||||
_CVoidPLike = _UnionT[_PointerLike, Array[Any], _CArgObject, int]
|
||||
_CVoidPLike = _PointerLike | Array[Any] | _CArgObject | int
|
||||
# Same as above, but including types known to be read-only (i. e. bytes).
|
||||
# This distinction is not strictly necessary (ctypes doesn't differentiate between const
|
||||
# and non-const pointers), but it catches errors like memmove(b'foo', buf, 4)
|
||||
# when memmove(buf, b'foo', 4) was intended.
|
||||
_CVoidConstPLike = _UnionT[_CVoidPLike, bytes]
|
||||
_CVoidConstPLike = _CVoidPLike | bytes
|
||||
|
||||
def addressof(obj: _CData) -> int: ...
|
||||
def alignment(obj_or_type: _CData | type[_CData]) -> int: ...
|
||||
@@ -208,7 +208,7 @@ class c_byte(_SimpleCData[int]): ...
|
||||
class c_char(_SimpleCData[bytes]):
|
||||
def __init__(self, value: int | bytes = ...) -> None: ...
|
||||
|
||||
class c_char_p(_PointerLike, _SimpleCData[Optional[bytes]]):
|
||||
class c_char_p(_PointerLike, _SimpleCData[bytes | None]):
|
||||
def __init__(self, value: int | bytes | None = ...) -> None: ...
|
||||
|
||||
class c_double(_SimpleCData[float]): ...
|
||||
@@ -233,10 +233,10 @@ class c_uint64(_SimpleCData[int]): ...
|
||||
class c_ulong(_SimpleCData[int]): ...
|
||||
class c_ulonglong(_SimpleCData[int]): ...
|
||||
class c_ushort(_SimpleCData[int]): ...
|
||||
class c_void_p(_PointerLike, _SimpleCData[Optional[int]]): ...
|
||||
class c_void_p(_PointerLike, _SimpleCData[int | None]): ...
|
||||
class c_wchar(_SimpleCData[str]): ...
|
||||
|
||||
class c_wchar_p(_PointerLike, _SimpleCData[Optional[str]]):
|
||||
class c_wchar_p(_PointerLike, _SimpleCData[str | None]):
|
||||
def __init__(self, value: int | str | None = ...) -> None: ...
|
||||
|
||||
class c_bool(_SimpleCData[bool]):
|
||||
|
||||
Reference in New Issue
Block a user