Message9792

Author jeff.allen
Recipients jeff.allen
Date 2015-04-10.15:32:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1428679968.32.0.0458282441534.issue2320@psf.upfronthosting.co.za>
In-reply-to
Content
>>> f = file('x.tmp', 'wb')
>>> fd = f.fileno()
>>> type(fd)
<type 'org.python.core.io.FileIO'>
>>> os.fstat(fd)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [Errno 9] Bad file descriptor
>>> int(fd)
-1
>>> f.close()

In this code:
https://hg.python.org/jython/rev/e1a246f6a178#l5.89
we get at the integer file descriptor (index) via the private member fd. In my experience (with the debugger) fd is only ever -1, but there is an extra member that holds a Windows file handle.

This is the cause of a failure in test_tempfile, but not elsewhere as I believe we have comprehensively adapted to file descriptors that are objects.

If we support integer file descriptors, don't we need a table for them to index, as in C (and CPython)?
History
Date User Action Args
2015-04-10 15:32:48jeff.allensetrecipients: + jeff.allen
2015-04-10 15:32:48jeff.allensetmessageid: <1428679968.32.0.0458282441534.issue2320@psf.upfronthosting.co.za>
2015-04-10 15:32:48jeff.allenlinkissue2320 messages
2015-04-10 15:32:47jeff.allencreate