Author r.david.murray
Recipients alexis.d, brian.curtin, neologix, r.david.murray
Date 2012-03-28.19:28:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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'>

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()

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.
Date User Action Args
2012-03-28 19:28:04r.david.murraysetrecipients: + r.david.murray, brian.curtin, neologix, alexis.d
2012-03-28 19:28:04r.david.murraysetmessageid: <>
2012-03-28 19:28:03r.david.murraylinkissue14433 messages
2012-03-28 19:28:03r.david.murraycreate