[issue11466] getpass.getpass doesn't close tty file

Anton Barkovsky report at bugs.python.org
Tue Jul 24 16:22:02 CEST 2012


Anton Barkovsky <swarmer.pm at gmail.com> added the comment:

I think I've found the root cause.

On my system (also tested in 3.2) /dev/tty is opened successfully, but wrapping it in io.BufferedRandom fails. By the time the exception is raised, FileIO object is already created, and then it immediately gets deleted.

I'm attaching a patch that closes the file explicitly in this case.
Be extra careful when reviewing though - this is the first time I'm touching Python's C code.

----------
Added file: http://bugs.python.org/file26498/closewarning.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11466>
_______________________________________


More information about the Python-bugs-list mailing list