From 764662020ba496164bf8dcb96d93c519f0968405 Mon Sep 17 00:00:00 2001 From: Andrew Kuchling Date: Tue, 15 Apr 2014 21:11:36 -0400 Subject: #15840: make docs consistent by saying operations on closed files raise ValueError. Patch by Caelyn McAulay. Neither Caelyn nor I could find any cases in 2.7 or 3.4/5 where an operation on a closed stream raised IOError; generally the C implementations have a macro to check for the stream being closed, and these macros all raised ValueError. If we find any, a new bug should be opened. --- Modules/_io/iobase.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/_io/iobase.c b/Modules/_io/iobase.c index e372990..ef06b43 100644 --- a/Modules/_io/iobase.c +++ b/Modules/_io/iobase.c @@ -42,8 +42,8 @@ PyDoc_STRVAR(iobase_doc, "bytes. bytearrays are accepted too, and in some cases (such as\n" "readinto) needed. Text I/O classes work with str data.\n" "\n" - "Note that calling any method (even inquiries) on a closed stream is\n" - "undefined. Implementations may raise IOError in this case.\n" + "Note that calling any method (except additional calls to close(),\n" + "which are ignored) on a closed stream should raise a ValueError.\n" "\n" "IOBase (and its subclasses) support the iterator protocol, meaning\n" "that an IOBase object can be iterated over yielding the lines in a\n" -- cgit v0.12 From 45278a898c0d6ac5a38a07b525fb216d9afa36df Mon Sep 17 00:00:00 2001 From: Andrew Kuchling Date: Tue, 15 Apr 2014 16:44:43 -0400 Subject: #1704474: mark refleak test as specific to CPython Patch by Christian Hudon. --- Lib/test/test_optparse.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Lib/test/test_optparse.py b/Lib/test/test_optparse.py index 3c8c612..7621c24 100644 --- a/Lib/test/test_optparse.py +++ b/Lib/test/test_optparse.py @@ -395,6 +395,7 @@ class TestOptionParser(BaseTest): self.assertRaises(self.parser.remove_option, ('foo',), None, ValueError, "no such option 'foo'") + @support.impl_detail('Relies on sys.getrefcount', cpython=True) def test_refleak(self): # If an OptionParser is carrying around a reference to a large # object, various cycles can prevent it from being GC'd in -- cgit v0.12