Thomas added the comment:

So after some more pondering about the issue I read the documentation again:

> Warning ctypes does not support passing unions or structures with bit-fields 
> to functions by value.

Previously I always read this as 'does not support passing unions with 
bit-fields'... I guess it is meant otherwise. IMHO this should be formulated 
more clearly, like: "does not support passing structures with bit-fields or 
unions to functions by value.".

Also I would strongly argue to generally prohibit this with an exception 
instead of just trying if libffi maybe handles this on the current 
architecture. libffi clearly does not support unions. This just introduces 
subtle bugs.

See also: https://github.com/atgreen/libffi/issues/33

----------
title: Segfault in cffi with ctypes.union argument -> Undefined behavior 
calling C functions with ctypes.Union arguments

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26628>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to