Skip to content

Commit dd7600e

Browse files
aiskerlend-aasland
authored andcommitted
Add test_ctypes/_support.py
This partially backports be89ee5 (python#113727) Co-authored-by: Erlend E. Aasland <[email protected]>
1 parent ad5349e commit dd7600e

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

Lib/test/test_ctypes/_support.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Some classes and types are not export to _ctypes module directly.
2+
3+
import ctypes
4+
from _ctypes import Structure, Union, _Pointer, Array, _SimpleCData, CFuncPtr
5+
6+
7+
_CData = Structure.__base__
8+
assert _CData.__name__ == "_CData"
9+
10+
class _X(Structure):
11+
_fields_ = [("x", ctypes.c_int)]
12+
CField = type(_X.x)
13+
14+
# metaclasses
15+
PyCStructType = type(Structure)
16+
UnionType = type(Union)
17+
PyCPointerType = type(_Pointer)
18+
PyCArrayType = type(Array)
19+
PyCSimpleType = type(_SimpleCData)
20+
PyCFuncPtrType = type(CFuncPtr)
21+
22+
# type flags
23+
Py_TPFLAGS_DISALLOW_INSTANTIATION = 1 << 7
24+
Py_TPFLAGS_IMMUTABLETYPE = 1 << 8

0 commit comments

Comments
 (0)