Ronald Oussoren added the comment:

> On 19 jul. 2014, at 23:22, Mark Dickinson <rep...@bugs.python.org> wrote:
> 
> 
> 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?

I haven't found a definitive source yet, but it seems that the only valid 
values for _Bool, which BOOL_TYPE expands to, are 0 and 1.  Clang might make 
use of that restriction. 

Ronald

----------
title: struct.unpack('?', '\x02') returns (False,) when Python is built with 
clang -> struct.unpack('?', '\x02') returns (False,) on Mac OSX

_______________________________________
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