This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author kristjan.jonsson
Recipients kristjan.jonsson
Date 2012-03-15.01:38:00
SpamBayes Score 1.9519757e-06
Marked as misclassified No
Message-id <1331775486.86.0.119356098147.issue14310@psf.upfronthosting.co.za>
In-reply-to
Content
winsock natively supports the duplciation of sockets for use on different processes.  This patch proposes to add that functionality:
socket.duplicate(target_pid) gets a bytes representation of the duplicate socket, usable for the target process.
socket.socket(x,y,z,data) creates the socket object from the bytes representation.

The patch contains a test using multiprocessing that works.
Note that multiprocessing already contains its own code to achieve this, and that code can possibly be simplified with this patch.

Note also the new function "duplicate."  Perhaps "dup(target_pid) would be better?  But it would have different semantics.  
Also notice how we overload the "fromfd" parameter in socket.socket() to recreate a socket from a bytes representation.  Maybe this is not ideal?
Looking for thoughs here.
History
Date User Action Args
2012-03-15 01:38:07kristjan.jonssonsetrecipients: + kristjan.jonsson
2012-03-15 01:38:06kristjan.jonssonsetmessageid: <1331775486.86.0.119356098147.issue14310@psf.upfronthosting.co.za>
2012-03-15 01:38:05kristjan.jonssonlinkissue14310 messages
2012-03-15 01:38:05kristjan.jonssoncreate