From tom at whyscream.net Fri Nov 9 18:26:40 2012 From: tom at whyscream.net (Tom Hendrikx) Date: Sat, 10 Nov 2012 00:26:40 +0100 Subject: [Pymilter] python3 support? Message-ID: <509D9130.2080000@whyscream.net> Hi, Is there any interest in getting pymilter to work with python3? I am going to write a new milter based on pymilter, but with all the new advancements in python3 I was interested in using that. I tried converting the pymilter source to python3. Using 2to3 on the python code seemed to work, and help of with of some 2to3-for-extension-code guides [1] [2] I managed to silence about half of the compile errors in the C code, but then I got stuck. Unfortunately my C skills are quite minimal. Attached are 2 patches containing the python and c changes done so far (python is just what 2to3 produced). I'd be happy to test the result if someone can comment at the rest of the issues. Current output show things like: $ python3 setup.py build_ext running build_ext building 'milter' extension creating build/temp.linux-x86_64-3.2 x86_64-pc-linux-gnu-gcc -pthread -fPIC -DMAX_ML_REPLY=32 -I/usr/include/python3.2 -c miltermodule.c -o build/temp.linux-x86_64-3.2/miltermodule.o miltermodule.c: In function ?milter_Context_getattr?: miltermodule.c:1521:3: warning: return makes pointer from integer without a cast miltermodule.c: At top level: miltermodule.c:1574:3: warning: initialization makes integer from pointer without a cast miltermodule.c:1577:9: warning: initialization from incompatible pointer type miltermodule.c:1579:9: warning: initialization from incompatible pointer type miltermodule.c:1592:9: warning: initialization makes pointer from integer without a cast miltermodule.c: In function ?setitem?: miltermodule.c:1602:17: warning: initialization makes pointer from integer without a cast miltermodule.c: In function ?initmilter?: miltermodule.c:1612:7: warning: initialization makes integer from pointer without a cast miltermodule.c:1613:7: warning: initialization from incompatible pointer type miltermodule.c:1614:7: warning: initialization makes pointer from integer without a cast miltermodule.c:1615:7: warning: initialization makes integer from pointer without a cast miltermodule.c:1619:7: warning: initialization makes integer from pointer without a cast creating build/lib.linux-x86_64-3.2 x86_64-pc-linux-gnu-gcc -pthread -shared build/temp.linux-x86_64-3.2/miltermodule.o -L/usr/lib/libmilter -L/usr/lib64 -lmilter -lpython3.2 -o build/lib.linux-x86_64-3.2/milter.cpython-32.so All of the above with gentoo linux x86_64, python 3.2.3, gcc 5.4.5 and pymilter 0.9.5 [1] http://python3porting.com/cextensions.html [2] http://docs.python.org/howto/cporting.html?highlight=pyunicode Kind regards, Tom Hendrikx -------------- next part -------------- A non-text attachment was scrubbed... Name: py2to3.patch Type: text/x-patch Size: 17399 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: c2to3.patch Type: text/x-patch Size: 2689 bytes Desc: not available URL: From stuart at bmsi.com Sat Nov 10 00:03:35 2012 From: stuart at bmsi.com (Stuart D Gathman) Date: Sat, 10 Nov 2012 00:03:35 -0500 (EST) Subject: [Pymilter] python3 support? In-Reply-To: <509D9130.2080000@whyscream.net> References: <509D9130.2080000@whyscream.net> Message-ID: On Nov 10, Tom Hendrikx transmitted in part: > Is there any interest in getting pymilter to work with python3? I took a brief look. Will have to change all the PyString to PyBytes or PyUnicode. I'm leaning toward splitting the py3 version (not trying to maintain 1 source and running 2to3 as part of build). That will let me make a few incompatible changes to the API. For instance, getting rid of all the set_XXX_callback module methods and likely using keyword args on register() as I did with the newer callbacks. So I created a python3-branch tag. From tom at whyscream.net Sun Nov 18 17:13:18 2012 From: tom at whyscream.net (Tom Hendrikx) Date: Sun, 18 Nov 2012 23:13:18 +0100 Subject: [Pymilter] python3 support? In-Reply-To: References: <509D9130.2080000@whyscream.net> Message-ID: <50A95D7E.2030100@whyscream.net> On 10-11-12 06:03, Stuart D Gathman wrote: > On Nov 10, Tom Hendrikx transmitted in part: > >> Is there any interest in getting pymilter to work with python3? > > I took a brief look. Will have to change all the PyString to PyBytes or > PyUnicode. I'm leaning toward splitting the py3 version (not trying > to maintain 1 source and running 2to3 as part of build). That will > let me make a few incompatible changes to the API. For instance, > getting rid of all the set_XXX_callback module methods and likely using > keyword args on register() as I did with the newer callbacks. > > So I created a python3-branch tag. > Hi Stuart, Nice! I checked it out today, but I see you only got to creating the branch, not adding/changing any code in it. I'll check back once in a while. If there's anything I can help with, please let me know. PS Sorry for the late reply, I was quite busy this week. -- Regards, Tom