[issue7523] add SOCK_NONBLOCK and SOCK_CLOEXEC to socket module

2011-10-27 Thread Vetoshkin Nikita
Vetoshkin Nikita added the comment: Sorry, wrong ticket. Right one is 10115 -- ___ Python tracker ___ ___ Python-bugs-list mailing lis

[issue7523] add SOCK_NONBLOCK and SOCK_CLOEXEC to socket module

2011-10-27 Thread Vetoshkin Nikita
Vetoshkin Nikita added the comment: Started implementing accept4() socket method and stuck on socket object's timeout attribute. What value should we assign to sock->sock_timeout if SOCK_NONBLOCK was specified in accept4() call? And in socket.py should we check as in original accept: if getde

[issue7523] add SOCK_NONBLOCK and SOCK_CLOEXEC to socket module

2010-10-14 Thread Antoine Pitrou
Antoine Pitrou added the comment: Patch committed in r85480, thanks! -- resolution: -> fixed stage: needs patch -> committed/rejected status: open -> closed ___ Python tracker _

[issue7523] add SOCK_NONBLOCK and SOCK_CLOEXEC to socket module

2010-10-13 Thread Vetoshkin Nikita
Vetoshkin Nikita added the comment: @Antoine already found that myself, patched and tested :) thanks! -- Added file: http://bugs.python.org/file19226/issue7523_py3k_accept4_2.diff ___ Python tracker ___

[issue7523] add SOCK_NONBLOCK and SOCK_CLOEXEC to socket module

2010-10-13 Thread Antoine Pitrou
Antoine Pitrou added the comment: > For some reason does another trip through BEGIN_SELECT_LOOP() macro Indeed: if (!timeout) +#ifdef HAVE_ACCEPT4 +/* inherit socket flags and use accept4 call */ +flags = s->sock_type & (SOCK_CLOEXEC | SOCK_NONBLOCK); +newfd = acce

[issue7523] add SOCK_NONBLOCK and SOCK_CLOEXEC to socket module

2010-10-13 Thread Vetoshkin Nikita
Vetoshkin Nikita added the comment: Here's what strace on FAIL shows (print "in alarm_handler" added) alarm(2)= 0 poll([{fd=3, events=POLLIN}], 1, 5000) = ? ERESTART_RESTARTBLOCK (To be restarted) --- SIGALRM (Alarm clock) @ 0 (0) --- rt_sigreturn(0x)

[issue7523] add SOCK_NONBLOCK and SOCK_CLOEXEC to socket module

2010-10-13 Thread Vetoshkin Nikita
Vetoshkin Nikita added the comment: Another patch with: - testInitBlocking method - no c++ style comments - a newly generated configure script (almost 1.5k lines diff) - proper accept4 availability check With this patch I've got Traceback (most recent call last): File "/home/nekto/worksp

[issue7523] add SOCK_NONBLOCK and SOCK_CLOEXEC to socket module

2010-10-13 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' : -- nosy: +giampaolo.rodola ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http:/

[issue7523] add SOCK_NONBLOCK and SOCK_CLOEXEC to socket module

2010-10-12 Thread Antoine Pitrou
Antoine Pitrou added the comment: You can check accept4() presence by adding it to the AC_CHECK_FUNCS macro in configure.in around line 2553, and add the corresponding HAVE_ACCEPT4 lines in pyconfig.h.in. Then run "autoconf" and you will have access to a HAVE_ACCEPT4 constant when accept4() e

[issue7523] add SOCK_NONBLOCK and SOCK_CLOEXEC to socket module

2010-10-12 Thread Vetoshkin Nikita
Vetoshkin Nikita added the comment: Thanks! I can see the problem now, but I think checking should be done like this: >>> fcntl.fcntl(c, fcntl.F_GETFD) & fcntl.FD_CLOEXEC 0 >>> fcntl.fcntl(s, fcntl.F_GETFD) & fcntl.FD_CLOEXEC 1 and with accept4() call I've got flag set: >>> fcntl.fcntl(c, fcntl

[issue7523] add SOCK_NONBLOCK and SOCK_CLOEXEC to socket module

2010-10-12 Thread Antoine Pitrou
Antoine Pitrou added the comment: The accept() issue is the following: the socket created by accept() (in Lib/socket.py) will formally inherit its parent's `type` attribute (including any SOCK_NONBLOCK and SOCK_CLOEXEC flags). However, the underlying Linux socket is created by the accept() sy

[issue7523] add SOCK_NONBLOCK and SOCK_CLOEXEC to socket module

2010-10-12 Thread Vetoshkin Nikita
Vetoshkin Nikita added the comment: Made an attempt to port lekma's patch to py3k-trunk. No (logical) changes needed. Don't know about accept4() issue. As I saw in Qt sources, they ifdef'ed CLOEXEC by default on file descriptors. Don't think it's acceptable :) in this particular case. So, @A

[issue7523] add SOCK_NONBLOCK and SOCK_CLOEXEC to socket module

2010-07-22 Thread Antoine Pitrou
Antoine Pitrou added the comment: > @Antoine could you respond to msg97699, thanks. Well my comments and the patch itself are outdated now that 2.7 is in bugfix mode. The socket implementation in 3.2 is slightly different, which means the patch should be updated (it isn't necessarily difficul

[issue7523] add SOCK_NONBLOCK and SOCK_CLOEXEC to socket module

2010-07-22 Thread Mark Lawrence
Mark Lawrence added the comment: @Antoine could you respond to msg97699, thanks. -- nosy: +BreamoreBoy versions: -Python 2.7 ___ Python tracker ___ _

[issue7523] add SOCK_NONBLOCK and SOCK_CLOEXEC to socket module

2010-01-13 Thread lekma
lekma added the comment: > lekma, do you have a real name that we should add to the ACKS file? no, lekma is fine (that's a nick I carry since childhood) > Looking at it again, there's the question of accept() behaviour. [...] Sorry for not having seen that earlier and thanks for pointing it out

[issue7523] add SOCK_NONBLOCK and SOCK_CLOEXEC to socket module

2010-01-12 Thread Antoine Pitrou
Antoine Pitrou added the comment: Looking at it again, there's the question of accept() behaviour. In the original code, it will call internal_setblocking() on the new fd if the listening socket is non-blocking. In the new code, if SOCK_NONBLOCK is defined it will not call any OS function to

[issue7523] add SOCK_NONBLOCK and SOCK_CLOEXEC to socket module

2010-01-12 Thread Antoine Pitrou
Antoine Pitrou added the comment: The patch is basically fine. I'll add a "try .. finally" to the tests. lekma, do you have a real name that we should add to the ACKS file? -- ___ Python tracker ___

[issue7523] add SOCK_NONBLOCK and SOCK_CLOEXEC to socket module

2009-12-20 Thread lekma
lekma added the comment: this one addresses Antoines's comments (with the help of R. David Murray). -- Added file: http://bugs.python.org/file15621/Issue7523_3.diff ___ Python tracker __

[issue7523] add SOCK_NONBLOCK and SOCK_CLOEXEC to socket module

2009-12-19 Thread R. David Murray
R. David Murray added the comment: I lean toward the second way, myself. -- ___ Python tracker ___ ___ Python-bugs-list mailing list U

[issue7523] add SOCK_NONBLOCK and SOCK_CLOEXEC to socket module

2009-12-19 Thread lekma
lekma added the comment: > It would be better to use test skipping: (eg: @unittest.SkipUnless > before the test class). I didn't know about this feature, thanks for the tip. Now I wonder if it would be better to do it this way: @unittest.SkipUnless(hasattr(socket, "SOCK_CLOEXEC") and fcntl, "S

[issue7523] add SOCK_NONBLOCK and SOCK_CLOEXEC to socket module

2009-12-18 Thread R. David Murray
R. David Murray added the comment: It would be better to use test skipping: (eg: @unittest.SkipUnless before the test class). -- nosy: +r.david.murray priority: -> normal stage: -> patch review ___ Python tracker

[issue7523] add SOCK_NONBLOCK and SOCK_CLOEXEC to socket module

2009-12-17 Thread lekma
lekma added the comment: > - when importing fcntl, bear in mind that some systems don't have this > module (e.g. Windows), so you should catch and silence the ImportError would something like the following be ok?: try: import fcntl except ImportError: fcntl = False and then: if hasat

[issue7523] add SOCK_NONBLOCK and SOCK_CLOEXEC to socket module

2009-12-17 Thread Antoine Pitrou
Antoine Pitrou added the comment: A couple of things: - the test shouldn't be marked as Linux-specific since perhaps these constants will be supported by other systems some day - when importing fcntl, bear in mind that some systems don't have this module (e.g. Windows), so you should catch and s

[issue7523] add SOCK_NONBLOCK and SOCK_CLOEXEC to socket module

2009-12-16 Thread lekma
lekma added the comment: better patch (mainly test refactoring). still against trunk. should I provide one against py3k? -- components: +IO Added file: http://bugs.python.org/file15578/Issue7523_2.diff ___ Python tracker

[issue7523] add SOCK_NONBLOCK and SOCK_CLOEXEC to socket module

2009-12-16 Thread lekma
lekma added the comment: First attempt, against trunk. -- keywords: +patch Added file: http://bugs.python.org/file15573/Issue7523.diff ___ Python tracker ___

[issue7523] add SOCK_NONBLOCK and SOCK_CLOEXEC to socket module

2009-12-16 Thread lekma
New submission from lekma : It would be nice to have those. See http://udrepper.livejournal.com/20407.html for background. -- components: Library (Lib) messages: 96482 nosy: lekma severity: normal status: open title: add SOCK_NONBLOCK and SOCK_CLOEXEC to socket module type: feature reque