Merge #17275: Fix class name in init errors in C bufferedio classes.
This fixes an apparent copy-and-paste error. Patch by Manuel Jacob.
This commit is contained in:
commit
d7c59e101f
|
@ -1080,6 +1080,12 @@ class CBufferedReaderTest(BufferedReaderTest, SizeofTest):
|
|||
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
|
||||
|
||||
|
@ -1371,6 +1377,11 @@ class CBufferedWriterTest(BufferedWriterTest, SizeofTest):
|
|||
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
|
||||
|
@ -1723,6 +1734,7 @@ class BufferedRandomTest(BufferedReaderTest, BufferedWriterTest):
|
|||
# You can't construct a BufferedRandom over a non-seekable stream.
|
||||
test_unseekable = None
|
||||
|
||||
|
||||
class CBufferedRandomTest(BufferedRandomTest, SizeofTest):
|
||||
tp = io.BufferedRandom
|
||||
|
||||
|
@ -1740,6 +1752,12 @@ class CBufferedRandomTest(BufferedRandomTest, SizeofTest):
|
|||
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
|
||||
|
||||
|
|
|
@ -558,6 +558,7 @@ Atsuo Ishimoto
|
|||
Adam Jackson
|
||||
Ben Jackson
|
||||
Paul Jackson
|
||||
Manuel Jacob
|
||||
David Jacobs
|
||||
Kevin Jacobs
|
||||
Kjetil Jacobsen
|
||||
|
|
|
@ -10,6 +10,9 @@ What's New in Python 3.4.0 Alpha 1?
|
|||
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.
|
||||
|
||||
|
|
|
@ -1822,7 +1822,7 @@ bufferedwriter_init(buffered *self, PyObject *args, PyObject *kwds)
|
|||
self->ok = 0;
|
||||
self->detached = 0;
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|n:BufferedReader", kwlist,
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|n:BufferedWriter", kwlist,
|
||||
&raw, &buffer_size)) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -2451,7 +2451,7 @@ bufferedrandom_init(buffered *self, PyObject *args, PyObject *kwds)
|
|||
self->ok = 0;
|
||||
self->detached = 0;
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|n:BufferedReader", kwlist,
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|n:BufferedRandom", kwlist,
|
||||
&raw, &buffer_size)) {
|
||||
return -1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue