Re: [Python-Dev] Best Python API for exposing posix_spawn

2018-01-08 Thread Serhiy Storchaka
09.01.18 01:05, Gregory P. Smith пише: On Mon, Jan 8, 2018 at 12:36 PM Serhiy Storchaka > wrote: 08.01.18 11:11, Pablo Galindo Salgado пише: > Following Gregory's comment on the PR I understand that he is proposing > to have

Re: [Python-Dev] PEP 567 v2

2018-01-08 Thread Nathaniel Smith
On Thu, Jan 4, 2018 at 9:42 PM, Guido van Rossum wrote: > On Thu, Jan 4, 2018 at 7:58 PM, Nathaniel Smith wrote: >> This does make me think that I should write up a short PEP for >> extending PEP 567 to add context lookup, PEP 550 style: it can start >> out in

Re: [Python-Dev] Best Python API for exposing posix_spawn

2018-01-08 Thread Serhiy Storchaka
09.01.18 05:31, Nick Coghlan пише: On 8 January 2018 at 19:11, Pablo Galindo Salgado wrote: Following Gregory's comment on the PR I understand that he is proposing to have three objects in the os module representing each action and pass a sequence of these objects to the

Re: [Python-Dev] PEP 567 pre v3

2018-01-08 Thread Nathaniel Smith
On Mon, Jan 8, 2018 at 11:34 AM, Yury Selivanov wrote: > 1. Proposal: ContextVar has default set to None. > > From the typing point of view that would mean that if a context > variable is declared without an explicit default, its type would be > Optional. E.g. say we

Re: [Python-Dev] PEP 567 pre v3

2018-01-08 Thread Guido van Rossum
When I +1'ed Yury's message I forgot about this issue. I actually prefer the current PEP 567 version -- .get() raises an error if there's no default on the ContextVar, and .get(None) returns None if there's no default. The idea here is that by far the most common use will be .get(), so it should

Re: [Python-Dev] Best Python API for exposing posix_spawn

2018-01-08 Thread Nick Coghlan
On 8 January 2018 at 19:11, Pablo Galindo Salgado wrote: > Following Gregory's comment on the PR I understand that he is proposing to > have three objects in the os module representing each action and pass a > sequence of these objects to the Python API. What I am not sure

Re: [Python-Dev] PEP 567 pre v3

2018-01-08 Thread Nick Coghlan
On 9 January 2018 at 05:34, Yury Selivanov wrote: > Maybe we can rename ContextVar.get() to ContextVar.lookup()? This > would help to avoid potential confusion between Context.get() and > ContextVar.get(). I think this would also tie in nicely with the PEP 568 draft,

Re: [Python-Dev] Best Python API for exposing posix_spawn

2018-01-08 Thread Brett Cannon
On Mon, 8 Jan 2018 at 15:06 Gregory P. Smith wrote: > On Mon, Jan 8, 2018 at 12:36 PM Serhiy Storchaka > wrote: > >> 08.01.18 11:11, Pablo Galindo Salgado пише: >> > Following Gregory's comment on the PR I understand that he is proposing >> > to have three

Re: [Python-Dev] Best Python API for exposing posix_spawn

2018-01-08 Thread Gregory P. Smith
On Mon, Jan 8, 2018 at 4:03 PM Random832 wrote: > On Mon, Jan 8, 2018, at 18:05, Gregory P. Smith wrote: > > i agree with just a list of tuples, but i suggest creating namedtuple > > instances in the posix module for the purpose (one each for close, dup2, > > open) .

Re: [Python-Dev] Best Python API for exposing posix_spawn

2018-01-08 Thread Random832
On Mon, Jan 8, 2018, at 18:05, Gregory P. Smith wrote: > i agree with just a list of tuples, but i suggest creating namedtuple > instances in the posix module for the purpose (one each for close, dup2, > open) . Don't put a reference to a function in the tuple as Serhiy > suggested as, while

Re: [Python-Dev] PEP 567 pre v3

2018-01-08 Thread Guido van Rossum
I am +1 on everything Yury says here. On Mon, Jan 8, 2018 at 11:34 AM, Yury Selivanov wrote: > Hi, > > Thanks to everybody participating in the PEP 567 discussion! I want > to summarize a few topics to make sure that we are all on the same > page (and maybe provoke

Re: [Python-Dev] PEP 567 pre v3

2018-01-08 Thread Victor Stinner
Hum, now I'm confused. I was probably confused by ContextVar.get() differences with Context.get(). It's fine if it behaves with a dict. Victor Le 9 janv. 2018 12:02 AM, "Nathaniel Smith" a écrit : > On Mon, Jan 8, 2018 at 2:35 PM, Victor Stinner >

Re: [Python-Dev] Best Python API for exposing posix_spawn

2018-01-08 Thread Gregory P. Smith
On Mon, Jan 8, 2018 at 12:36 PM Serhiy Storchaka wrote: > 08.01.18 11:11, Pablo Galindo Salgado пише: > > Following Gregory's comment on the PR I understand that he is proposing > > to have three objects in the os module representing each action and pass > > a sequence of

Re: [Python-Dev] PEP 567 pre v3

2018-01-08 Thread Nathaniel Smith
On Mon, Jan 8, 2018 at 2:35 PM, Victor Stinner wrote: > ctx[var] raises an exception but ctx.get(var) returns None in such case. My > point is just that Context.get() behaves differently than dict.get(). If > dict[key] raises, I expect that dict.get() raises too and that

Re: [Python-Dev] PEP 567 pre v3

2018-01-08 Thread Victor Stinner
Le 8 janv. 2018 8:36 PM, "Yury Selivanov" a écrit : 2. Context.__contains__, Context.__getitem__ and ContexVar.default So if we keep the current PEP 567 behaviour w.r.t. defaults, ContextVar.get() might return a different value from Context.get(): v =

Re: [Python-Dev] subprocess not escaping "^" on Windows

2018-01-08 Thread Steve Dower
On 09Jan2018 0744, eryk sun wrote: It's common to discourage using `shell=True` because it's considered insecure. One of the reasons to use CMD in Windows is that it tries ShellExecuteEx if CreateProcess fails. ShellExecuteEx supports "App Paths" commands, file actions (open, edit, print), UAC

Re: [Python-Dev] subprocess not escaping "^" on Windows

2018-01-08 Thread eryk sun
On Sun, Jan 7, 2018 at 6:48 PM, Christian Tismer wrote: > That is true. > list2cmdline escapes partially, but on NT and Windows10, the "^" must > also be escaped, but is not. The "|" pipe symbol must also be escaped > by "^", as many others as well. > > The effect was that

Re: [Python-Dev] Best Python API for exposing posix_spawn

2018-01-08 Thread Serhiy Storchaka
08.01.18 11:11, Pablo Galindo Salgado пише: Following Gregory's comment on the PR I understand that he is proposing to have three objects in the os module representing each action and pass a sequence of these objects to the Python API. What I am not sure about this is that there is no previous

Re: [Python-Dev] Best Python API for exposing posix_spawn

2018-01-08 Thread Brett Cannon
On Mon, 8 Jan 2018 at 07:57 Pablo Galindo Salgado wrote: > Hi, > > I'm currently working on exposing posix_spawn in the posix module (and by > extension in the os module). You can find the initial implementation in > this PR: > > https://github.com/python/cpython/pull/5109 >

[Python-Dev] PEP 567 pre v3

2018-01-08 Thread Yury Selivanov
Hi, Thanks to everybody participating in the PEP 567 discussion! I want to summarize a few topics to make sure that we are all on the same page (and maybe provoke more discussion). 1. Proposal: ContextVar has default set to None. >From the typing point of view that would mean that if a

[Python-Dev] Best Python API for exposing posix_spawn

2018-01-08 Thread Pablo Galindo Salgado
Hi, I'm currently working on exposing posix_spawn in the posix module (and by extension in the os module). You can find the initial implementation in this PR: https://github.com/python/cpython/pull/5109 As pointed out by Gregory P. Smith, some changes are needed in the way the file_actions