From b487e632826a45bb81925d1577856637c3fcafa0 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Sat, 21 Mar 2009 03:08:31 +0000 Subject: [PATCH] stringio doesn't have an encoding --- Lib/_pyio.py | 4 ++++ Lib/test/test_memoryio.py | 2 +- Modules/_stringio.c | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Lib/_pyio.py b/Lib/_pyio.py index 771d4ce5818..5a7d2cac127 100644 --- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -1834,3 +1834,7 @@ class StringIO(TextIOWrapper): # TextIOWrapper tells the encoding in its repr. In StringIO, # that's a implementation detail. return object.__repr__(self) + + @property + def encoding(self): + return None diff --git a/Lib/test/test_memoryio.py b/Lib/test/test_memoryio.py index b3fc0422d7b..ad04613daf4 100644 --- a/Lib/test/test_memoryio.py +++ b/Lib/test/test_memoryio.py @@ -451,7 +451,7 @@ class PyStringIOTest(MemoryTestMixin, MemorySeekTestMixin, unittest.TestCase): # These are just dummy values but we nevertheless check them for fear # of unexpected breakage. - self.assertEqual(memio.encoding, "utf-8") + self.assertTrue(memio.encoding is None) self.assertEqual(memio.errors, "strict") self.assertEqual(memio.line_buffering, False) diff --git a/Modules/_stringio.c b/Modules/_stringio.c index a88fcb747b1..d75a604a1fc 100644 --- a/Modules/_stringio.c +++ b/Modules/_stringio.c @@ -665,7 +665,7 @@ stringio_encoding(StringIOObject *self, void *context) { CHECK_INITIALIZED(self); CHECK_CLOSED(self); - return PyUnicode_FromString("utf-8"); + Py_RETURN_NONE; } static PyObject *