Tal Einat <talei...@gmail.com> added the comment:

> And yes, by binary passwords I mean that the module needs to support being 
> passed a bytes-like object as the password, since clearly there are servers 
> "in the wild" that support non-ascii passwords and the only way to be sure 
> one can send the server the correct password is by treating it as a series of 
> bytes.  The library caller will have to be responsible for picking the 
> correct encoding based on local knowledge.

Perhaps we should make smtplib accept only bytes, passing on the responsibility 
of using an appropriate encoding to its users?  This seems like the most 
straightforward and transparent choice. It would not be backwards-compatible, 
though.

Alternatively, we could change smtplib to accept passwords as bytes or strings, 
but raise an informative exception when given strings with non-ASCII 
characters.  As now, users could be surprised if they have been passing 
passwords as string and hadn't tested their use of smtplib with non-ASCII 
passwords.  We'd just improve the exception and documentation to clarify the 
situation.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue29750>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to