Message 237825 - Python tracker

Message237825

Author martin.panter
Recipients martin.panter, mattip, steve.dower, tim.golden, zach.ware
Date 2015-03-10.23:35:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1426030540.01.0.328991557447.issue23634@psf.upfronthosting.co.za>
In-reply-to
Content
I guess you were mainly testing with Python 2. Python 3 on Linux does not raise any error either:

wrote 3 to a read-only file
should raise, opening a ro descriptor for writing
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

BTW in your test script you close the underlying file descriptor “fd” before giving the file object “fd2” a chance to flush or close, which is probably why you see no error. Though in Wine I see this, probably because file.write() does not return a value in Python 2:

properly raised TypeError('%d format: a number is required, not NoneType',)

What would be the reason for doing a mode check in fdopen()? Just to detect programmer errors if the wrong mode or file descriptor is given?
History
Date User Action Args
2015-03-10 23:35:40martin.pantersetrecipients: + martin.panter, tim.golden, zach.ware, mattip, steve.dower
2015-03-10 23:35:40martin.pantersetmessageid: <1426030540.01.0.328991557447.issue23634@psf.upfronthosting.co.za>
2015-03-10 23:35:39martin.panterlinkissue23634 messages
2015-03-10 23:35:39martin.pantercreate