Vajrasky Kok added the comment:

Fixing IO leak resource would fix this bug but leave another bug opened which I 
try to fix as well.

These statements with Python3 under Linux will always fail because we need to 
open /dev/tty file in binary mode (for whatever reason).

fd = os.open('/dev/tty', os.O_RDWR|os.O_NOCTTY)
tty = os.fdopen(fd, 'w+', 1)

So I guess the correct fix would be to open /dev/tty in binary mode (and set 
buffering off) and go on from there.

Of course, one can argue whether this bug should be separated from the original 
bug (resource warning). I am not sure either.

Anyway, here is the patch that will work with stream StringIO and stdout.

Thank you for Serhiy for pointing out my mistakes.

----------
Added file: 
http://bugs.python.org/file30483/getpass_fix_works_with_stringio_and_stdout_stream.patch

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

Reply via email to