[Python-checkins] cpython (3.2): #17275: Fix class name in init errors in C bufferedio classes.
r.david.murray
python-checkins at python.org
Sun Feb 24 04:22:16 CET 2013
http://hg.python.org/cpython/rev/d6a26cd93825
changeset: 82373:d6a26cd93825
branch: 3.2
parent: 82369:cda4a9dc415a
user: R David Murray <rdmurray at bitdance.com>
date: Sat Feb 23 21:51:05 2013 -0500
summary:
#17275: Fix class name in init errors in C bufferedio classes.
This fixes an apparent copy-and-paste error.
Patch by Manuel Jacob.
files:
Lib/test/test_io.py | 18 ++++++++++++++++++
Misc/ACKS | 1 +
Misc/NEWS | 3 +++
Modules/_io/bufferedio.c | 4 ++--
4 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py
--- a/Lib/test/test_io.py
+++ b/Lib/test/test_io.py
@@ -1039,6 +1039,12 @@
support.gc_collect()
self.assertTrue(wr() is None, wr)
+ def test_args_error(self):
+ # Issue #17275
+ with self.assertRaisesRegex(TypeError, "BufferedReader"):
+ self.tp(io.BytesIO(), 1024, 1024, 1024)
+
+
class PyBufferedReaderTest(BufferedReaderTest):
tp = pyio.BufferedReader
@@ -1321,6 +1327,11 @@
with self.open(support.TESTFN, "rb") as f:
self.assertEqual(f.read(), b"123xxx")
+ def test_args_error(self):
+ # Issue #17275
+ with self.assertRaisesRegex(TypeError, "BufferedWriter"):
+ self.tp(io.BytesIO(), 1024, 1024, 1024)
+
class PyBufferedWriterTest(BufferedWriterTest):
tp = pyio.BufferedWriter
@@ -1674,6 +1685,7 @@
# You can't construct a BufferedRandom over a non-seekable stream.
test_unseekable = None
+
class CBufferedRandomTest(BufferedRandomTest, SizeofTest):
tp = io.BufferedRandom
@@ -1691,6 +1703,12 @@
CBufferedReaderTest.test_garbage_collection(self)
CBufferedWriterTest.test_garbage_collection(self)
+ def test_args_error(self):
+ # Issue #17275
+ with self.assertRaisesRegex(TypeError, "BufferedRandom"):
+ self.tp(io.BytesIO(), 1024, 1024, 1024)
+
+
class PyBufferedRandomTest(BufferedRandomTest):
tp = pyio.BufferedRandom
diff --git a/Misc/ACKS b/Misc/ACKS
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -505,6 +505,7 @@
Adam Jackson
Ben Jackson
Paul Jackson
+Manuel Jacob
David Jacobs
Kevin Jacobs
Kjetil Jacobsen
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,9 @@
Core and Builtins
-----------------
+- Issue #17275: Corrected class name in init error messages of the C version of
+ BufferedWriter and BufferedRandom.
+
- Issue #7963: Fixed misleading error message that issued when object is
called without arguments.
diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c
--- a/Modules/_io/bufferedio.c
+++ b/Modules/_io/bufferedio.c
@@ -1702,7 +1702,7 @@
self->ok = 0;
self->detached = 0;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|nn:BufferedReader", kwlist,
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|nn:BufferedWriter", kwlist,
&raw, &buffer_size, &max_buffer_size)) {
return -1;
}
@@ -2339,7 +2339,7 @@
self->ok = 0;
self->detached = 0;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|nn:BufferedReader", kwlist,
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|nn:BufferedRandom", kwlist,
&raw, &buffer_size, &max_buffer_size)) {
return -1;
}
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list