homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author dwight.guth
Recipients dwight.guth
Date 2013年05月28日.16:31:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1369758688.03.0.231740499906.issue18082@psf.upfronthosting.co.za>
In-reply-to
Content
Consider the following program:
import io 
class A(io.IOBase): 
 def __init__(self): 
 self.x = 5 
 def read(self, limit=-1): 
 self.x -= 1 
 if self.x > 0: 
 return b"5" 
 return b"" 
 def seek(self, offset, whence=0): 
 return 0 
 def write(self, b): 
 pass 
 
a = A() 
a.close() 
assert a.__next__() == b"5555" 
assert a.readline() == b"" 
assert a.tell() == 0
These three operations succeed, even though the file is closed. However, these two operations fail:
a.readlines()
a.writelines([])
Why do some of the mixin methods on IOBase call _checkClosed and others don't?
History
Date User Action Args
2013年05月28日 16:31:28dwight.guthsetrecipients: + dwight.guth
2013年05月28日 16:31:28dwight.guthsetmessageid: <1369758688.03.0.231740499906.issue18082@psf.upfronthosting.co.za>
2013年05月28日 16:31:28dwight.guthlinkissue18082 messages
2013年05月28日 16:31:27dwight.guthcreate

AltStyle によって変換されたページ (->オリジナル) /