[Python-Dev] python sendmsg()/recvmsg() implementation

Kálmán Gergely kalman.gergely at duodecad.hu
Mon Jun 15 13:47:55 CEST 2009


Jean-Paul Calderone wrote:
> On Tue, 09 Jun 2009 16:46:54 +0200, Kálmán Gergely 
> <kalman.gergely at duodecad.hu> wrote:
>> Hello, my name is Greg.
>>
>> I've just started using python after many years of C programming, and 
>> I'm also new to the list. I wanted to clarify this
>> first, so that maybe I will get a little less beating for my 
>> stupidity :)
>>
>
> Welcome!
>
>>
>> [snip]
>>
>> Browsing the net I've found a patch to the python core 
>> (http://bugs.python.org/issue1194378), dated 2005.
>>
>> First of all, I would like to ask you guys, whether you know of any 
>> way of doing this FD passing magic, or that you know
>> of any 3rd party module / patch / anything that can do this for me.
>
> Aside from the patch in the tracker, there are several implementations of
> these APIs as third-party extension modules.
>
>>
>> Since I'm fairly familiar with C and (not that much, but I feel the 
>> power) python, I would take the challenge of writing
>> it, given that the above code is still somewhat usable. If all else 
>> fails I would like to have your help to guide me through
>> this process.
>>
>
> What would be great is if you could take the patch in the tracker and get
> it into shape so that it is suitable for inclusion.  This would involve
> three things, I think:
>
>  1. Write unit tests for the functionality (since the patch itself 
> provides
>     none)
>  2. Update the patch so that it again applies cleanly against trunk
>  3. Add documentation for the new APIs
>
> Once this is done, you can get a committer to look at it and either 
> provide
> more specific feedback or apply it.
>
> Thanks,
>
> Jean-Paul
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: 
> http://mail.python.org/mailman/options/python-dev/synapse%40jasmin.hu

Hello again

So, after a little cleanup I've managed to integrate the code into 
socketmodule.c/h. It works fine now, though I needed to
add it to Lib/socket.py, otherwise it wouldn't show up in the socket 
module (I've searched for recvfrom and added it).
I've also cleaned up the code a little, fixed some codingstyle issues 
(which might still exist).

Since I am not a python core developer the patch might still be in a 
pretty outdated state. I'd like someone to look it over
and direct me to some documentation (the ones I've found so far were 
pretty sketchy), for it to be acceptable for inclusion.
The sanity of the code is what matters to me the most. I've looked it 
over though and found it in a sound state, but I guess
you guys might have a different opinion about that ;)

With writing the test cases, some documentation would be nice.

I've attached the patch generated with svn diff for revision 73434, and 
the test code that I use to pass a file descriptor
between processes. It works just fine :).

Thanks

Kalman Gergely

-------------- next part --------------
A non-text attachment was scrubbed...
Name: sendmsg.diff
Type: text/x-patch
Size: 19805 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-dev/attachments/20090615/588e82e4/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sendfd.py
Type: text/x-python
Size: 1353 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-dev/attachments/20090615/588e82e4/attachment-0001.py>


More information about the Python-Dev mailing list