Author petr.viktorin
Recipients ammar2, benjamin.peterson, cstratak, gregory.p.smith, mark.dickinson, meador.inge, petr.viktorin, vstinner
Date 2020-03-11.15:59:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1583942352.14.0.188116020469.issue39689@roundup.psfhosted.org>
In-reply-to
Content
> > > maybe we should be raising an error if the bytes are not a valid platform _Bool pattern?
> > 
> > That's quite hard to test for.
> 
> How so? We just make the same assumption you're making that true = b'\x01' and false = NUL.

Right, with that assumption, it's not that hard. And it becomes a test-only assumption, which is great!

But, I'm still not convinced this would be a good fix. The current struct documentation is consistent with *casting* char to _Bool, rather than doing the memcpy and reinterpreting as _Bool. The memcpy makes sense for larget types, but not so much for _Bool.

(Certainly, the docs' assertion that "the conversion between C and Python values should be obvious given their types" is not true here...)
History
Date User Action Args
2020-03-11 15:59:12petr.viktorinsetrecipients: + petr.viktorin, gregory.p.smith, mark.dickinson, vstinner, benjamin.peterson, meador.inge, cstratak, ammar2
2020-03-11 15:59:12petr.viktorinsetmessageid: <1583942352.14.0.188116020469.issue39689@roundup.psfhosted.org>
2020-03-11 15:59:12petr.viktorinlinkissue39689 messages
2020-03-11 15:59:12petr.viktorincreate