mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 04:54:47 +08:00
move byref-related definitions from ctypes/__init__.pyi to _ctypes.pyi (#10137)
This commit is contained in:
@@ -8,6 +8,7 @@ from _ctypes import (
|
||||
Structure as Structure,
|
||||
Union as Union,
|
||||
_CanCastTo as _CanCastTo,
|
||||
_CArgObject as _CArgObject,
|
||||
_CData as _CData,
|
||||
_CDataMeta as _CDataMeta,
|
||||
_CField as _CField,
|
||||
@@ -18,6 +19,7 @@ from _ctypes import (
|
||||
_StructUnionMeta as _StructUnionMeta,
|
||||
addressof as addressof,
|
||||
alignment as alignment,
|
||||
byref as byref,
|
||||
get_errno as get_errno,
|
||||
pointer as pointer,
|
||||
resize as resize,
|
||||
@@ -120,8 +122,6 @@ if sys.platform == "win32":
|
||||
|
||||
def PYFUNCTYPE(restype: type[_CData] | None, *argtypes: type[_CData]) -> type[_FuncPointer]: ...
|
||||
|
||||
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: TypeAlias = _PointerLike | Array[Any] | _CArgObject | int
|
||||
@@ -131,8 +131,6 @@ _CVoidPLike: TypeAlias = _PointerLike | Array[Any] | _CArgObject | int
|
||||
# when memmove(buf, b'foo', 4) was intended.
|
||||
_CVoidConstPLike: TypeAlias = _CVoidPLike | bytes
|
||||
|
||||
def byref(obj: _CData, offset: int = ...) -> _CArgObject: ...
|
||||
|
||||
_CastT = TypeVar("_CastT", bound=_CanCastTo)
|
||||
|
||||
def cast(obj: _CData | _CArgObject | int, typ: type[_CastT]) -> _CastT: ...
|
||||
|
||||
Reference in New Issue
Block a user