Author petr.viktorin
Recipients ammar2, benjamin.peterson, cstratak, gregory.p.smith, mark.dickinson, meador.inge, miss-islington, petr.viktorin, ronaldoussoren, skrah, vstinner
Date 2020-03-18.09:49:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I think we are speaking past each other.

In my (current) view, the semantics are spelled out in the documentation: "any non-zero value will be True when unpacking".
There's also a mention that this corresponds to the _Bool type in C. While this was the case with compilers in the past, it's no longer true with clang 9.

In your view, the semantics are dictated by the correspondence to _Bool, and the "non-zero value will be True when unpacking" is the fluff to be ignored and removed.

The docs assume the two behaviors (_Bool and non-zero) are equivalent. In this bug we find out that they are not, so to fix the bug, we need to make a choice which one to keep and which one to throw out.
I see nothing that would make one view inherently better than the other.

What "array libraries expect" is IMO not relevant: under any of the two views, libraries that are well-written (under that view) will be fine. Problems come when the library and Python choose different sides, e.g. when a non-C library can't use _Bool and thus packs arrays with the expectation that "any non-zero value will be True when unpacking".

What is a minimal change in *implementation* is a bigger change in *behavior*: unpacking of arrays will now depend greatly on details like the compiler used to build Python. I see that as the greater evil: since the data can be sharted across environments, languages and compilers, keeping the semantics well-defined seems better than leaving them to the compiler.
I don't see a compelling reason to choose _Bool semantics, but perhaps there is one.
Date User Action Args
2020-03-18 09:49:59petr.viktorinsetrecipients: + petr.viktorin, gregory.p.smith, ronaldoussoren, mark.dickinson, vstinner, benjamin.peterson, skrah, meador.inge, cstratak, ammar2, miss-islington
2020-03-18 09:49:58petr.viktorinsetmessageid: <>
2020-03-18 09:49:58petr.viktorinlinkissue39689 messages
2020-03-18 09:49:58petr.viktorincreate