Eryk Sun <[email protected]> added the comment:
> With Python 3.7.6 this raises an exception at the ctypes.CFUNCTYPE()
> call with
> ...
> TypeError: item 1 in _argtypes_ passes a struct/union with a bitfield
> by value, which is unsupported.
I cannot reproduce the problem as stated in 3.7.6 in Windows. The TypeError
only occurs if I use the struct type directly in argtypes, not a pointer to the
struct type. For example:
>>> class A(ctypes.Structure):
... _fields_ = (('x', ctypes.c_uint, 1),)
>>> class P_A(ctypes._Pointer):
... _type_ = A
...
allowed:
>>> class FP_P_A(ctypes._CFuncPtr):
... _flags_ = ctypes._FUNCFLAG_CDECL
... _argtypes_ = (P_A,)
disallowed:
>>> class FP_A(ctypes._CFuncPtr):
... _flags_ = ctypes._FUNCFLAG_CDECL
... _argtypes_ = (A,)
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: item 1 in _argtypes_ passes a struct/union with a bitfield by
value, which is unsupported.
This seems rights to me. There is no problem passing a pointer as a function
parameter.
----------
nosy: +eryksun
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue39295>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com