R. David Murray <rdmur...@bitdance.com> added the comment: To make this a little clearer, here's an even simpler example:
>>> import os >>> os.fdopen(0) <_io.TextIOWrapper name=0 mode='r' encoding='UTF-8'> >>> 1 __main__:1: ResourceWarning: unclosed file <_io.TextIOWrapper name=0 mode='r' encoding='UTF-8'> 1 >>> rdmurray@hey:~/python/p32> What is happening here is that the file returned by os.fdopen is assigned to _, and then when I enter '1' *it* gets assigned to _, and the file gets gced and closed. You can also see this directly: >>> import os >>> f = os.fdopen(0) >>> f.close() >>> rdmurray@hey:~/python/p32> I explain this at length because I didn't understand it until I played around with it. @Brian: this isn't a crash. It is completely equivalent to pressing <ctl>D at the interactive interpreter prompt. ---------- nosy: +r.david.murray status: open -> closed _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue14433> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com