[issue1378] fromfd() and dup() for _socket on WIndows

2012-05-09 Thread Arthur Kantor
Arthur Kantor added the comment: Hi guys It appears, that this patch was meant to go into both the 2.x and 3.x series, but it never made into 2.x Are there still plans to apply it to 2.7? (apologies if I'm asking this in the wrong forum) -- nosy: +Arthur.Kantor versions: +Python 2

[issue1378] fromfd() and dup() for _socket on WIndows

2009-10-19 Thread Preston Landers
Preston Landers added the comment: Hmm... revision 59004 appears to be unrelated to the main issue at hand. As far as I can tell now the status is this: the dup() and fromfd() support appears to be present in Python 3000 for Windows - at least the py3k branch. I didn't check the releases. But

[issue1378] fromfd() and dup() for _socket on WIndows

2009-10-16 Thread Senthil Kumaran
Senthil Kumaran added the comment: On Sun, Oct 04, 2009 at 05:39:26PM +, Preston Landers wrote: > I'm curious what happened with this issue. It says closed+accepted but > it doesn't appear to be checked in. If you see the report, the last message indicates that it is checked in revision

[issue1378] fromfd() and dup() for _socket on WIndows

2009-10-04 Thread Preston Landers
Preston Landers added the comment: I'm curious what happened with this issue. It says closed+accepted but it doesn't appear to be checked in. Was there a fatal problem implementing this feature on Windows? Is it hung up on the inability to dup SSL sockets? I'm highly interested in deployi

[issue1378] fromfd() and dup() for _socket on WIndows

2007-11-15 Thread Guido van Rossum
Guido van Rossum added the comment: I've submitted socket2.diff plus small changes to ssl.py. This seems the best I can do given that I don't think I can make dup() work on ssl sockets. -- resolution: -> accepted status: open -> closed __ Tracker <[EMAIL

[issue1378] fromfd() and dup() for _socket on WIndows

2007-11-15 Thread Guido van Rossum
Guido van Rossum added the comment: Thanks! roudkerk's patch is submitted as revision 59004. BTW I need to go back to the drawing board for the rest of the socket patch here. Using dup() in makefile() doesn't work for the ssl.SSLSocket class. Maybe the explicit reference counting is the best

[issue1378] fromfd() and dup() for _socket on WIndows

2007-11-15 Thread roudkerk
roudkerk added the comment: Currently on Windows set_error() make use of a large array which maps socket error numbers to error messages. This patch (against socketmodule.c from Python 2.6) removes that array and just lets PyErr_SetExcFromWindowsErr() generate the message by using the Win32 f

[issue1378] fromfd() and dup() for _socket on WIndows

2007-11-15 Thread Guido van Rossum
Guido van Rossum added the comment: Hold on, socket3.diff breaks four unit tests: test_ftplib test_poplib test_smtplib test_urllib2net > newfd = _socket.dup(socket_instance) But that doesn't allow fromfd to work. I found some real use cases for fromfd where the fd is passed in through some oth

[issue1378] fromfd() and dup() for _socket on WIndows

2007-11-15 Thread Christian Heimes
Christian Heimes added the comment: I've yet another idea for a tiny improvement. Instead of doing newfd = _socket.dup(socket_instance.fileno()) I prefer newfd = _socket.dup(socket_instance) It removes some confusing magic and makes error checking on Windows slightly easier. __

[issue1378] fromfd() and dup() for _socket on WIndows

2007-11-15 Thread Guido van Rossum
Guido van Rossum added the comment: Forgot to upload socket3.diff. Added file: http://bugs.python.org/file8759/socket3.diff __ Tracker <[EMAIL PROTECTED]> __Index: Include/longobject.h ===

[issue1378] fromfd() and dup() for _socket on WIndows

2007-11-15 Thread Guido van Rossum
Guido van Rossum added the comment: socket3.diff builds on socket2.diff: - Rename socket class to Socket; add socket() as a factory function. - Implement roudkerk's suggestion of using a duplicate socket in makefile() to get rid of the manual reference counting. Yay! Note: this dinterferes wit

[issue1378] fromfd() and dup() for _socket on WIndows

2007-11-15 Thread Guido van Rossum
Guido van Rossum added the comment: socket2.diff makes dup() a module-level function in _socket (and hence in socket.py) and uses that to implement fromfd() in socket.py. No changes otherwise compared to py3k_another_socket.patch. Added file: http://bugs.python.org/file8758/socket2.diff __

[issue1378] fromfd() and dup() for _socket on WIndows

2007-11-15 Thread Guido van Rossum
Guido van Rossum added the comment: - I'm hoping that Bill can submit his SSL changes first. - If we make _dup() a module-level function, we can implement fromfd() in Python. I'll do this now. __ Tracker <[EMAIL PROTECTED]>

[issue1378] fromfd() and dup() for _socket on WIndows

2007-11-15 Thread Guido van Rossum
Guido van Rossum added the comment: > I've reviewed your patch and merged it was some pending changes of my > own. The socket tests are passing on Windows. Great work :) You didn't upload this though. __ Tracker <[EMAIL PROTECTED]>

[issue1378] fromfd() and dup() for _socket on WIndows

2007-11-15 Thread Christian Heimes
Christian Heimes added the comment: Oh, I forgot Added file: http://bugs.python.org/file8757/py3k_another_socket.patch __ Tracker <[EMAIL PROTECTED]> __Index: Include/longobject.h

[issue1378] fromfd() and dup() for _socket on WIndows

2007-11-15 Thread Christian Heimes
Changes by Christian Heimes: __ Tracker <[EMAIL PROTECTED]> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/py

[issue1378] fromfd() and dup() for _socket on WIndows

2007-11-15 Thread Guido van Rossum
Guido van Rossum added the comment: roudkerk, can you turn that suggestion into a proper patch? __ Tracker <[EMAIL PROTECTED]> __ ___ Python-bugs-list ma

[issue1378] fromfd() and dup() for _socket on WIndows

2007-11-15 Thread roudkerk
roudkerk added the comment: >From Guido's patch: >if (!DuplicateHandle(GetCurrentProcess(), (HANDLE)handle, > GetCurrentProcess(), &newhandle, > 0, FALSE, DUPLICATE_SAME_ACCESS)) >{ >WSASetLastError(GetLastE

[issue1378] fromfd() and dup() for _socket on WIndows

2007-11-14 Thread Christian Heimes
Christian Heimes added the comment: I've reviewed your patch and merged it was some pending changes of my own. The socket tests are passing on Windows. Great work :) UPDATE: * Added PyLong_FromSocket_t and PyLong_AsSocket_t to longobject.h to get rid of some 64bit warnings * Use name dup_socket(

[issue1378] fromfd() and dup() for _socket on WIndows

2007-11-14 Thread Guido van Rossum
Changes by Guido van Rossum: Removed file: http://bugs.python.org/file8747/socket.diff __ Tracker <[EMAIL PROTECTED]> __ ___ Python-bugs-list mailing li

[issue1378] fromfd() and dup() for _socket on WIndows

2007-11-14 Thread Guido van Rossum
Guido van Rossum added the comment: New version of socket.diff. The only change is better docstrings for accept() and dup(). Added file: http://bugs.python.org/file8748/socket.diff __ Tracker <[EMAIL PROTECTED]> ___

[issue1378] fromfd() and dup() for _socket on WIndows

2007-11-14 Thread Guido van Rossum
Guido van Rossum added the comment: PS. socket.diff is for 3.0. I'll backport once this is accepted. __ Tracker <[EMAIL PROTECTED]> __ ___ Python-bugs-li

[issue1378] fromfd() and dup() for _socket on WIndows

2007-11-14 Thread Guido van Rossum
Guido van Rossum added the comment: Here's a new version along the lines I described. Please test on Windows. It works on Linux and OSX. What this includes: - the dup-on-windows implementation by R Oudkerk, with the GetLastError() suggestion from Thomas Heller. - Replace the C implementations o

[issue1378] fromfd() and dup() for _socket on WIndows

2007-11-14 Thread Guido van Rossum
Guido van Rossum added the comment: Crys, did you actually run the tests for the 3.0 port of the patch? I think accept() is broken, as it checks for _can_dup_socket and will attempt to call os.dup(). I'm thinking that we should change the C class to not create new objects on accept() and dup() -

[issue1378] fromfd() and dup() for _socket on WIndows

2007-11-14 Thread Guido van Rossum
Guido van Rossum added the comment: > On Windows socket.fromfd() is not possible. Socket handlers and file > descriptors are different types using different API methods. Other > examples for the discrepancy are select.select() and select.poll(). On > Windows they don't work on file. I know, but,

[issue1378] fromfd() and dup() for _socket on WIndows

2007-11-14 Thread Christian Heimes
Christian Heimes added the comment: > I'm disappointed that this doesn't implement socket.fromfd() properly. > Perhaps fromfd() needs to be implemented in socketmodule.c? On Windows socket.fromfd() is not possible. Socket handlers and file descriptors are different types using different API meth

[issue1378] fromfd() and dup() for _socket on WIndows

2007-11-14 Thread Christian Heimes
Christian Heimes added the comment: Port of the socket_fromfd.patch to py3k Added file: http://bugs.python.org/file8746/py3k_socket_fromfd.patch __ Tracker <[EMAIL PROTECTED]> __Index: Lib/socket.

[issue1378] fromfd() and dup() for _socket on WIndows

2007-11-14 Thread Guido van Rossum
Guido van Rossum added the comment: I'm disappointed that this doesn't implement socket.fromfd() properly. Perhaps fromfd() needs to be implemented in socketmodule.c? Also, the whole mess with the _base slot can be gotten rid of; accept() can use the dup() method instead. __

[issue1378] fromfd() and dup() for _socket on WIndows

2007-11-14 Thread Thomas Heller
Thomas Heller added the comment: Christian Heimes schrieb: > Neal, Thomas, what do you think about the patch? Your knowledge of the > Windows API is greater than mine. Is the duplicate_socket() function ok? > I don't want to apply a patch I don't fully understand. > > +#ifdef MS_WINDOWS > +/* On

[issue1378] fromfd() and dup() for _socket on WIndows

2007-11-14 Thread Christian Heimes
Christian Heimes added the comment: Neal, Thomas, what do you think about the patch? Your knowledge of the Windows API is greater than mine. Is the duplicate_socket() function ok? I don't want to apply a patch I don't fully understand. +#ifdef MS_WINDOWS +/* On Windows a socket is really a handl

[issue1378] fromfd() and dup() for _socket on WIndows

2007-11-14 Thread Guido van Rossum
Guido van Rossum added the comment: Never mind. I must've searched for fromdf. Crys, I think this is good to go into 2.6 and be merged into 3.0. Then in 3.0 we can simplify Bill Janssen's patch further. -- assignee: -> tiran __ Tracker <[EMAIL PROTECTE

[issue1378] fromfd() and dup() for _socket on WIndows

2007-11-14 Thread Guido van Rossum
Guido van Rossum added the comment: I'd like to see this applied, HOWEVER I'm confused. I don't see any mention of fromfd in the patch except in a comment. Now, in 3.0, fromfd() is implemented in socket.py using os.dup(); but in 2.6 i don't see it there either. What's going in? I am hoping th

[issue1378] fromfd() and dup() for _socket on WIndows

2007-11-09 Thread Christian Heimes
Christian Heimes added the comment: I've created a clean patch and tested it. It works as promised, great work! Somebody with more Windows Fu than me should verify it before it's applied. -- nosy: +tiran Added file: http://bugs.python.org/file8723/trunk_socket_fromfd.patch _

[issue1378] fromfd() and dup() for _socket on WIndows

2007-11-04 Thread Guido van Rossum
Changes by Guido van Rossum: -- nosy: +gvanrossum __ Tracker <[EMAIL PROTECTED]> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail

[issue1378] fromfd() and dup() for _socket on WIndows

2007-11-04 Thread roudkerk
Changes by roudkerk: -- versions: +Python 2.6 -Python 2.5 __ Tracker <[EMAIL PROTECTED]> __ ___ Python-bugs-list mailing list Unsubscribe: htt

[issue1378] fromfd() and dup() for _socket on WIndows

2007-11-03 Thread Martin v. Löwis
Changes by Martin v. Löwis: -- keywords: +patch __ Tracker <[EMAIL PROTECTED]> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.p

[issue1378] fromfd() and dup() for _socket on WIndows

2007-11-03 Thread roudkerk
New submission from roudkerk: The patch adds support for _socket.fromfd() and _socket.socket.dup() on Windows. It uses the Win32 DuplicateHandle() function. The patch is to socketmodule.c an test_socket.py. -- files: socket_fromfd.patch messages: 57084 nosy: roudkerk severity: normal s