Skip to content

Commit

Permalink
Use positional-only parameters for ctypes functions (#12341)
Browse files Browse the repository at this point in the history
  • Loading branch information
max-muoto committed Jul 14, 2024
1 parent 16341c7 commit 1b9e90b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 18 deletions.
10 changes: 0 additions & 10 deletions stdlib/@tests/stubtest_allowlists/py313.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
# =========================

# TODO: triage these new errors
_ctypes.POINTER
_ctypes.addressof
_ctypes.alignment
_ctypes.pointer
_ctypes.sizeof
_thread.interrupt_main
_thread.lock
_thread.start_joinable_thread
Expand All @@ -18,21 +13,16 @@ codecs.namereplace_errors
codecs.replace_errors
codecs.strict_errors
codecs.xmlcharrefreplace_errors
ctypes.POINTER
ctypes._endian.DEFAULT_MODE
ctypes._endian.RTLD_GLOBAL
ctypes._endian.RTLD_LOCAL
ctypes._endian.SIZEOF_TIME_T
ctypes._endian.cdll
ctypes._endian.pydll
ctypes._endian.pythonapi
ctypes.addressof
ctypes.alignment
ctypes.c_char_p.from_param
ctypes.c_void_p.from_param
ctypes.c_wchar_p.from_param
ctypes.pointer
ctypes.sizeof
ctypes.wintypes.PCHAR.from_param
ctypes.wintypes.PWCHAR.from_param
doctest.TestResults.__doc__
Expand Down
15 changes: 7 additions & 8 deletions stdlib/_ctypes.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ class _CData(metaclass=_CDataMeta):
# Structure.from_buffer(...) # valid at runtime
# Structure(...).from_buffer(...) # invalid at runtime
#

@classmethod
def from_buffer(cls, source: WriteableBuffer, offset: int = ...) -> Self: ...
@classmethod
Expand Down Expand Up @@ -100,8 +99,8 @@ class _Pointer(_PointerLike, _CData, Generic[_CT]):
def __getitem__(self, key: slice, /) -> list[Any]: ...
def __setitem__(self, key: int, value: Any, /) -> None: ...

def POINTER(type: type[_CT]) -> type[_Pointer[_CT]]: ...
def pointer(arg: _CT, /) -> _Pointer[_CT]: ...
def POINTER(type: type[_CT], /) -> type[_Pointer[_CT]]: ...
def pointer(obj: _CT, /) -> _Pointer[_CT]: ...

class _CArgObject: ...

Expand Down Expand Up @@ -203,9 +202,9 @@ class Array(_CData, Generic[_CT]):
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...

def addressof(obj: _CData) -> int: ...
def alignment(obj_or_type: _CData | type[_CData]) -> int: ...
def addressof(obj: _CData, /) -> int: ...
def alignment(obj_or_type: _CData | type[_CData], /) -> int: ...
def get_errno() -> int: ...
def resize(obj: _CData, size: int) -> None: ...
def set_errno(value: int) -> int: ...
def sizeof(obj_or_type: _CData | type[_CData]) -> int: ...
def resize(obj: _CData, size: int, /) -> None: ...
def set_errno(value: int, /) -> int: ...
def sizeof(obj_or_type: _CData | type[_CData], /) -> int: ...

0 comments on commit 1b9e90b

Please sign in to comment.