Skip to content

Commit 1c6eb33

Browse files
junkmdAlexWaygoodAkuli
authored
add and migrate constants from ctypes/__init__.pyi to _ctypes.pyi (#8643)
Co-authored-by: Alex Waygood <[email protected]> Co-authored-by: Akuli <[email protected]>
1 parent c72c9a6 commit 1c6eb33

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

stdlib/_ctypes.pyi

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@ import sys
22
from ctypes import _CArgObject, _PointerLike
33
from typing_extensions import TypeAlias
44

5+
FUNCFLAG_CDECL: int
6+
FUNCFLAG_PYTHONAPI: int
7+
FUNCFLAG_USE_ERRNO: int
8+
FUNCFLAG_USE_LASTERROR: int
9+
RTLD_GLOBAL: int
10+
RTLD_LOCAL: int
11+
512
if sys.version_info >= (3, 11):
613
CTYPES_MAX_ARGCOUNT: int
714

stdlib/ctypes/__init__.pyi

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,17 @@ from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence
55
from typing import Any, ClassVar, Generic, TypeVar, Union as _UnionT, overload
66
from typing_extensions import TypeAlias
77

8+
# TODO: import these from _ctypes once it no longer breaks pytype
9+
RTLD_GLOBAL: int
10+
RTLD_LOCAL: int
11+
812
if sys.version_info >= (3, 9):
913
from types import GenericAlias
1014

1115
_T = TypeVar("_T")
1216
_DLLT = TypeVar("_DLLT", bound=CDLL)
1317
_CT = TypeVar("_CT", bound=_CData)
1418

15-
RTLD_GLOBAL: int
16-
RTLD_LOCAL: int
1719
DEFAULT_MODE: int
1820

1921
class CDLL:

tests/stubtest_allowlists/py3_common.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -341,16 +341,10 @@ wave.Wave_write.initfp
341341

342342
_ctypes.Array
343343
_ctypes.CFuncPtr
344-
_ctypes.FUNCFLAG_CDECL
345-
_ctypes.FUNCFLAG_PYTHONAPI
346-
_ctypes.FUNCFLAG_USE_ERRNO
347-
_ctypes.FUNCFLAG_USE_LASTERROR
348344
_ctypes.POINTER
349345
_ctypes.PyObj_FromPtr
350346
_ctypes.Py_DECREF
351347
_ctypes.Py_INCREF
352-
_ctypes.RTLD_GLOBAL
353-
_ctypes.RTLD_LOCAL
354348
_ctypes.Structure
355349
_ctypes.Union
356350
_ctypes.addressof

0 commit comments

Comments
 (0)