Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions stdlib/_ctypes.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ import sys
from ctypes import _CArgObject, _PointerLike
from typing_extensions import TypeAlias

FUNCFLAG_CDECL: int
FUNCFLAG_PYTHONAPI: int
FUNCFLAG_USE_ERRNO: int
FUNCFLAG_USE_LASTERROR: int
RTLD_GLOBAL: int
RTLD_LOCAL: int

if sys.version_info >= (3, 11):
CTYPES_MAX_ARGCOUNT: int

Expand Down
6 changes: 4 additions & 2 deletions stdlib/ctypes/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@ from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence
from typing import Any, ClassVar, Generic, TypeVar, Union as _UnionT, overload
from typing_extensions import TypeAlias

# TODO: import these from _ctypes once it no longer breaks pytype
RTLD_GLOBAL: int
RTLD_LOCAL: int

if sys.version_info >= (3, 9):
from types import GenericAlias

_T = TypeVar("_T")
_DLLT = TypeVar("_DLLT", bound=CDLL)
_CT = TypeVar("_CT", bound=_CData)

RTLD_GLOBAL: int
RTLD_LOCAL: int
DEFAULT_MODE: int

class CDLL:
Expand Down
6 changes: 6 additions & 0 deletions tests/pytype_exclude_list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ stubs/mysqlclient/MySQLdb/__init__.pyi
stubs/mysqlclient/MySQLdb/connections.pyi
stubs/mysqlclient/MySQLdb/cursors.pyi

# errors about circular imports
stdlib/ctypes/__init__.pyi
stdlib/ctypes/util.pyi
stdlib/ctypes/wintypes.pyi
stdlib/_ctypes.pyi

Comment thread
Akuli marked this conversation as resolved.
Outdated
# _pb2.pyi have some constructs that break pytype
# Eg
# pytype.pyi.parser.ParseError: File: "/Users/nipunn/src/typeshed/third_party/2and3/google/protobuf/descriptor_pb2.pyi", line 195
Expand Down
6 changes: 0 additions & 6 deletions tests/stubtest_allowlists/py3_common.txt
Original file line number Diff line number Diff line change
Expand Up @@ -341,16 +341,10 @@ wave.Wave_write.initfp

_ctypes.Array
_ctypes.CFuncPtr
_ctypes.FUNCFLAG_CDECL
_ctypes.FUNCFLAG_PYTHONAPI
_ctypes.FUNCFLAG_USE_ERRNO
_ctypes.FUNCFLAG_USE_LASTERROR
_ctypes.POINTER
_ctypes.PyObj_FromPtr
_ctypes.Py_DECREF
_ctypes.Py_INCREF
_ctypes.RTLD_GLOBAL
_ctypes.RTLD_LOCAL
_ctypes.Structure
_ctypes.Union
_ctypes.addressof
Expand Down