[Pymilter] python3 support?

Tom Hendrikx tom at whyscream.net
Fri Nov 9 18:26:40 EST 2012


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: <http://gathman.org/pipermail/pymilter/attachments/20121110/db43757a/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: c2to3.patch
Type: text/x-patch
Size: 2689 bytes
Desc: not available
URL: <http://gathman.org/pipermail/pymilter/attachments/20121110/db43757a/attachment-0001.bin>


More information about the Pymilter mailing list