Gabriel Genellina <gagsl-...@yahoo.com.ar> added the comment:

Yes, the unicode flag is irrelevant to the password. To successfuly 
decrypt a file, one must know the password *and* the encoding in use 
when it was written, so the only sensible thing to do is to accept 
bytes only.

Your patch looks good to me with a few comments:

- I'd only check the password in setpassword() and open(); the other 
methods eventually call open().

- The issue version says "3.0"; but it should be applied to 2.6 2.7 
and 3.1 too.

- For 3.0 the check is wrong, should say "bytes" instead of "str". 
Even in 2.6 should use "bytes" to make clear the intent.

- The usual wording for such TypeError is more like "pwd: 
expected 'bytes', got '%s'"

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

Reply via email to