[Python-Dev] Re: Merging PRs without CLA signed

2020-02-27 Thread Brett Cannon
My personal stance is if Microsoft Word could have come up with the change then a signed CLA is _probably_ not needed (IOW typos and grammatical errors). But honestly, I fall into the same camp as Mariatta and Pablo out of laziness and fear of being wrong. :) Laziness because there are plenty of

[Python-Dev] Re: Accepting PEP 584: Add Union Operators To dict

2020-02-27 Thread Brandt Bucher
Thanks for your response Serhiy. > Yes, but this is a different thing. You must to implement new __or__ in a > subclass to make the behavior of d1 | d2 be different from {**d1, **d2}. Really? I'm sorry, but this doesn't feel like a real argument to me. There was no clear compatible path before.

[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 *)&x, 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: > struct.unpack('>

[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

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

2020-02-27 Thread Charalampos Stratakis
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: struct.unpack('>?', b'\xf0') means to unpack a "native bool", i.e. native size and alignment. Internall

[Python-Dev] Re: Accepting PEP 584: Add Union Operators To dict

2020-02-27 Thread Claudio Jolowicz
Let me split my case into two points: 1) The intuition that the right-hand side of `a | b` is a fallback value 2) The claim that `a |= b` is a common idiom to assign defaults About 2) It appears that the idiom in 2) is less common than I assumed. My expectations were shaped by working with a C++

[Python-Dev] Re: Accepting PEP 584: Add Union Operators To dict

2020-02-27 Thread Chris Angelico
On Thu, Feb 27, 2020 at 8:15 PM Serhiy Storchaka wrote: > > 27.02.20 10:46, Chris Angelico пише: > > On Thu, Feb 27, 2020 at 7:41 PM Serhiy Storchaka > > wrote: > >> sympy/utilities/runtests.py > >> > >> Sorry, but the current code > >> > >> globs = globs.copy() > >> if extraglobs is not None: >

[Python-Dev] Re: Accepting PEP 584: Add Union Operators To dict

2020-02-27 Thread Kyle Stanley
> So I've also never come across "|=" being used for this purpose. IIRC, the JavaScript implementation of "|=" can potentially be used in the way Claudio described it, instead it's based on the truthiness of the left-hand operand rather than it being "unset". But it works in that context because "

[Python-Dev] Re: Accepting PEP 584: Add Union Operators To dict

2020-02-27 Thread Serhiy Storchaka
27.02.20 10:46, Chris Angelico пише: On Thu, Feb 27, 2020 at 7:41 PM Serhiy Storchaka wrote: sympy/utilities/runtests.py Sorry, but the current code globs = globs.copy() if extraglobs is not None: globs.update(extraglobs) looks much clearer to me than the proposed globs = globs | (ext

[Python-Dev] Re: Accepting PEP 584: Add Union Operators To dict

2020-02-27 Thread Chris Angelico
On Thu, Feb 27, 2020 at 7:41 PM Serhiy Storchaka wrote: > sympy/utilities/runtests.py > > Sorry, but the current code > > globs = globs.copy() > if extraglobs is not None: > globs.update(extraglobs) > > looks much clearer to me than the proposed > > globs = globs | (extraglobs if extraglobs i

[Python-Dev] Re: Accepting PEP 584: Add Union Operators To dict

2020-02-27 Thread Serhiy Storchaka
18.02.20 19:35, Brandt Bucher пише: ...it was decided that `d1 | d2` also should ignore the types of the operands and always return a dict. And it accepts only dicts, not general mappings, in difference to `{**d1, **d2}`. So the only disadvantage of `{**d1, **d2}` is that it is not well known a