Mark Dickinson added the comment:

The relevant piece of code in the struct module looks like this:

static PyObject *
nu_bool(const char *p, const formatdef *f)
{
    BOOL_TYPE x;
    memcpy((char *)&x, p, sizeof x);
    return PyBool_FromLong(x != 0);
}

Is it possible that BOOL_TYPE is a bitfield of length 1, and that clang is 
somehow making use of that fact?

One thing I don't understand is that this shouldn't affect *standard* packing 
and unpacking (as opposed to native), but I still see the problem for a format 
of "<????".  However, it's fine for ">????".  Some debugging shows that we're 
calling 'nu_bool' even for "<????", which is a bit odd.

----------
nosy: +mark.dickinson

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

Reply via email to