add missing ctypes things (#13147)

This commit is contained in:
Stephen Morton
2024-11-28 12:09:47 -08:00
committed by GitHub
parent 5c7d51f3b8
commit 7a0f6837e9
4 changed files with 17 additions and 11 deletions

View File

@@ -26,7 +26,7 @@ from _ctypes import (
)
from ctypes._endian import BigEndianStructure as BigEndianStructure, LittleEndianStructure as LittleEndianStructure
from typing import Any, ClassVar, Generic, TypeVar
from typing_extensions import Self, TypeAlias
from typing_extensions import Self, TypeAlias, deprecated
if sys.platform == "win32":
from _ctypes import FormatError as FormatError, get_last_error as get_last_error, set_last_error as set_last_error
@@ -39,6 +39,7 @@ if sys.version_info >= (3, 9):
_T = TypeVar("_T")
_DLLT = TypeVar("_DLLT", bound=CDLL)
_CT = TypeVar("_CT", bound=_CData)
DEFAULT_MODE: int
@@ -122,6 +123,11 @@ def create_string_buffer(init: int | bytes, size: int | None = None) -> Array[c_
c_buffer = create_string_buffer
def create_unicode_buffer(init: int | str, size: int | None = None) -> Array[c_wchar]: ...
@deprecated("Deprecated in Python 3.13; removal scheduled for Python 3.15")
def SetPointerType(
pointer: type[_Pointer[Any]], cls: Any # noqa: F811 # Redefinition of unused `pointer` from line 22
) -> None: ...
def ARRAY(typ: _CT, len: int) -> Array[_CT]: ... # Soft Deprecated, no plans to remove
if sys.platform == "win32":
def DllCanUnloadNow() -> int: ...
@@ -166,6 +172,8 @@ class c_void_p(_PointerLike, _SimpleCData[int | None]):
@classmethod
def from_param(cls, value: Any, /) -> Self | _CArgObject: ...
c_voidp = c_void_p # backwards compatibility (to a bug)
class c_wchar(_SimpleCData[str]): ...
c_int8 = c_byte

View File

@@ -4,3 +4,5 @@ def find_library(name: str) -> str | None: ...
if sys.platform == "win32":
def find_msvcrt() -> str | None: ...
def test() -> None: ...