[Pymilter] Python3: how to proceed

Tom Hendrikx tom at whyscream.net
Wed Oct 19 16:37:22 EDT 2016


On 18-10-16 02:58, Stuart D. Gathman wrote:
> The sample.py milter is working in python3 now.  Here are
> some bytes/str decisions that have to be made moving to python3.
> 
> The connect callback gets a hostname - this is still a str. What do you
> think?  Make that bytes also?
> 
> The helo callback gets whatever the SMTP client sends for hostname.
> Should probably be bytes.
> 
> The header callback is getting str.  I'm thinking that header should
> also get bytes, although that will mean adding some code changes for
> existing milters (e.g. 'foo' -> b'foo').  The header name and value
> passed to header callback are not decoded - although milters are always
> free to depunycode for instance.
> 
> The body callback gets passed bytes now.
> 
> The unknown callback (commands MTA doesn't recognize) is still a str.
> Change to bytes?
> 
> milter.Context.getsymval currently returns str.  The MTA is actually
> passing null terminated bytes.  Change that?
> 

I think most raw data interfaces (sockets etc) in Python3 expose bytes
to the programmer, so giving bytes back everywhere seems logical. This
will cause some work for milter maintainers, but migrating code to
python3 was never 'free'. And being consistent in all data returned by
pymilter methods makes things easier, for both new implementations and
migrating existing ones.

Kind regards,
	Tom

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://gathman.org/pipermail/pymilter/attachments/20161019/a62c7da7/attachment.sig>


More information about the Pymilter mailing list