[Python-Dev] Re: Unpacking native bools in the struct module: Is Python relying on undefined behavior?

2020-02-27 Thread Serge Guelton
> Quick and obvious fix: > > static PyObject * > nu_bool(const char *p, const formatdef *f) > { > char x; > memcpy((char *), p, sizeof x); > return PyBool_FromLong(x != 0); > } Which is optimized to static PyObject * nu_bool(const char

[Python-Dev] Re: Unpacking native bools in the struct module: Is Python relying on undefined behavior?

2020-02-27 Thread Serge Guelton
On Thu, Feb 27, 2020 at 10:51:39AM -0500, Charalampos Stratakis wrote: > Hello folks, > > I recently observed a failure on the s390x fedora rawhide buildbot, on the > clang builds, when clang got updated to version 10: > https://bugs.python.org/issue39689 > > The call: >

[Python-Dev] Re: Unpacking native bools in the struct module: Is Python relying on undefined behavior?

2020-02-27 Thread Petr Viktorin
On 2020-02-27 17:14, Serge Guelton wrote: On Thu, Feb 27, 2020 at 10:51:39AM -0500, Charalampos Stratakis wrote: Hello folks, I recently observed a failure on the s390x fedora rawhide buildbot, on the clang builds, when clang got updated to version 10: https://bugs.python.org/issue39689