Issue #5677: Explicitly forbid write operations on read-only file objects,

and read operations on write-only file objects.  On Windows, the system C
library would return a bogus result; on Solaris, it was possible to crash
the interpreter.  Patch by Stefan Krah.
This commit is contained in:
Antoine Pitrou 2010-02-05 17:05:54 +00:00
parent 007a618a38
commit bb445a1f22
6 changed files with 77 additions and 1 deletions

View file

@ -581,7 +581,7 @@ class SizeofTest(unittest.TestCase):
# enumerate
check(enumerate([]), size(h + 'l3P'))
# file
check(self.file, size(h + '4P2i4P3i3Pi'))
check(self.file, size(h + '4P2i4P3i3P3i'))
# float
check(float(0), size(h + 'd'))
# sys.floatinfo