Re: [Python-Dev] Set close-on-exec flag by default in SocketServer

2013-01-09 Thread Victor Stinner
2013/1/10 Victor Stinner : > A better API is maybe to add a "cloexec" argument to open(), ... I realized that setting close-on-exec flag is a non trivial problem. There are many ways to set it depending on the function, on the OS, and on the OS version. There is also the difficult question of the

Re: [Python-Dev] Set close-on-exec flag by default in SocketServer

2013-01-09 Thread Victor Stinner
2013/1/9 Charles-François Natali : >> My question is: would you accept to break backward compatibility (in >> Python 3.4) to fix a potential security vulnerability? > > Although obvious, the security implications are not restricted to > sockets (yes, it's a contrived example): > ... > f = open("/tm

Re: [Python-Dev] Set close-on-exec flag by default in SocketServer

2013-01-09 Thread Charles-François Natali
> My question is: would you accept to break backward compatibility (in > Python 3.4) to fix a potential security vulnerability? Although obvious, the security implications are not restricted to sockets (yes, it's a contrived example): """ # cat test_inherit.py import fcntl import os import pwd imp

Re: [Python-Dev] Arena terminology (PyArena vs obmalloc.c:"arena")

2013-01-09 Thread Benjamin Peterson
2013/1/9 Trent Nelson : > There's no correlation between PyArenas and the extensive use of the > term "arena" in obmalloc.c, right? Correct. -- Regards, Benjamin ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/

[Python-Dev] Arena terminology (PyArena vs obmalloc.c:"arena")

2013-01-09 Thread Trent Nelson
There's no correlation between PyArenas and the extensive use of the term "arena" in obmalloc.c, right? I initially assumed there was, based solely on the common use of the term arena. However, after more investigation, it *appears* as though there's absolutely no correlation.

Re: [Python-Dev] Set close-on-exec flag by default in SocketServer

2013-01-09 Thread Senthil Kumaran
On Wed, Jan 9, 2013 at 4:48 AM, Victor Stinner wrote: > My question is: would you accept to break backward compatibility (in > Python 3.4) to fix a potential security vulnerability? > > If not, an alternative is to add an option, disabled by default, to > enable (or disable) explicitly close-on-ex

[Python-Dev] Set close-on-exec flag by default in SocketServer

2013-01-09 Thread Victor Stinner
Hi, The SocketServer class creates a socket to listen on clients, and a new socket per client (only for stream server like TCPServer, not for UDPServer). Until recently (2011-05-24, issue #5715), the listening socket was not closed after fork for the ForkingMixIn flavor. This caused two issues: i

Re: [Python-Dev] [Python-ideas] PEP 3156 - Asynchronous IO Support Rebooted

2013-01-09 Thread Nick Coghlan
On Wed, Jan 9, 2013 at 8:55 PM, Yuriy Taraday wrote: > My interns told me that they remember EOF as special object only from high > school when they had to study Pascal. I guess, in 5 years students won't > understand how one can write an EOF. (and schools will finally replace > Pascal with Python

Re: [Python-Dev] PEP 3156 - Asynchronous IO Support Rebooted

2013-01-09 Thread Yuriy Taraday
On Wed, Jan 9, 2013 at 1:39 PM, Antoine Pitrou wrote: > > Hi Yuriy, > > For the record, it isn't necessary to cross-post. python-ideas is > the place for discussing this, and most interested people will be > subscribed to both python-ideas and python-dev, and therefore they get > duplicate messag

Re: [Python-Dev] PEP 3156 - Asynchronous IO Support Rebooted

2013-01-09 Thread Yuriy Taraday
On Wed, Jan 9, 2013 at 10:02 AM, Guido van Rossum wrote: > Changing event loops in the middle of event processing is not a common > (or even useful) pattern. You start the event loop and then leave it > alone. > Yes. It was not-so-great morning idea. > Yes, 'write' part is good, I should menti

Re: [Python-Dev] PEP 3156 - Asynchronous IO Support Rebooted

2013-01-09 Thread Yuriy Taraday
On Wed, Jan 9, 2013 at 8:50 AM, Guido van Rossum wrote: > On Tue, Jan 8, 2013 at 8:31 PM, Guido van Rossum wrote: > > On Tue, Jan 8, 2013 at 5:14 PM, Yuriy Taraday > wrote: > >> - pause() and resume() work with reading only, so they should be > suffixed > >> (prefixed) with read(ing), like paus

Re: [Python-Dev] PEP 3156 - Asynchronous IO Support Rebooted

2013-01-09 Thread Antoine Pitrou
Hi Yuriy, For the record, it isn't necessary to cross-post. python-ideas is the place for discussing this, and most interested people will be subscribed to both python-ideas and python-dev, and therefore they get duplicate messages. Regards Antoine. Le Wed, 9 Jan 2013 05:14:02 +0400, Yuriy Ta

Re: [Python-Dev] PEP 3156 - Asynchronous IO Support Rebooted

2013-01-09 Thread Glyph
On Jan 8, 2013, at 9:14 PM, Guido van Rossum wrote: > But which half? A socket is two independent streams, one in each > direction. Twisted uses half_close() for this concept but unless you > already know what this is for you are left wondering which half. Which > is why I like using 'write' in t