This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eryksun
Recipients Matthew Newville, cheryl.sabella, eryksun, vinay.sajip
Date 2020-01-14.21:00:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1579035611.51.0.124590726212.issue39295@roundup.psfhosted.org>
In-reply-to
Content
> 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.
History
Date User Action Args
2020-01-14 21:00:11eryksunsetrecipients: + eryksun, vinay.sajip, cheryl.sabella, Matthew Newville
2020-01-14 21:00:11eryksunsetmessageid: <1579035611.51.0.124590726212.issue39295@roundup.psfhosted.org>
2020-01-14 21:00:11eryksunlinkissue39295 messages
2020-01-14 21:00:11eryksuncreate