mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-18 09:55:59 +08:00
add missing ctypes things (#13147)
This commit is contained in:
@@ -66,10 +66,6 @@ xml.sax.expatreader
|
||||
# TODO: Module members that exist at runtime, but are missing from stubs
|
||||
# ==========
|
||||
_thread.RLock
|
||||
ctypes.ARRAY
|
||||
ctypes.SetPointerType
|
||||
ctypes.c_voidp
|
||||
ctypes.util.test
|
||||
multiprocessing.managers.Server.accepter
|
||||
multiprocessing.managers.Server.create
|
||||
multiprocessing.managers.Server.debug_info
|
||||
@@ -101,12 +97,6 @@ multiprocessing.synchronize.Semaphore.get_value
|
||||
tkinter.Misc.config
|
||||
tkinter.font.Font.counter
|
||||
|
||||
_ctypes.PyObj_FromPtr
|
||||
_ctypes.Py_DECREF
|
||||
_ctypes.Py_INCREF
|
||||
_ctypes.buffer_info
|
||||
_ctypes.call_cdeclfunction
|
||||
_ctypes.call_function
|
||||
|
||||
# ==========
|
||||
# Modules that exist at runtime, but are deliberately missing from stubs
|
||||
|
||||
@@ -326,3 +326,9 @@ def get_errno() -> int: ...
|
||||
def resize(obj: _CData | _CDataType, size: int, /) -> None: ...
|
||||
def set_errno(value: int, /) -> int: ...
|
||||
def sizeof(obj_or_type: _CData | _CDataType | type[_CData | _CDataType], /) -> int: ...
|
||||
def PyObj_FromPtr(address: int, /) -> Any: ...
|
||||
def Py_DECREF(o: _T, /) -> _T: ...
|
||||
def Py_INCREF(o: _T, /) -> _T: ...
|
||||
def buffer_info(o: _CData | _CDataType | type[_CData | _CDataType], /) -> tuple[str, int, tuple[int, ...]]: ...
|
||||
def call_cdeclfunction(address: int, arguments: tuple[Any, ...], /) -> Any: ...
|
||||
def call_function(address: int, arguments: tuple[Any, ...], /) -> Any: ...
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -4,3 +4,5 @@ def find_library(name: str) -> str | None: ...
|
||||
|
||||
if sys.platform == "win32":
|
||||
def find_msvcrt() -> str | None: ...
|
||||
|
||||
def test() -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user