]> granicus.if.org Git - python/commitdiff
stringio doesn't have an encoding
authorBenjamin Peterson <benjamin@python.org>
Sat, 21 Mar 2009 03:08:31 +0000 (03:08 +0000)
committerBenjamin Peterson <benjamin@python.org>
Sat, 21 Mar 2009 03:08:31 +0000 (03:08 +0000)
Lib/_pyio.py
Lib/test/test_memoryio.py
Modules/_stringio.c

index 771d4ce5818399e8e85dbe02c47f7d6b23e84eaf..5a7d2cac127e9b9cc14fba263b463dd7d47d3911 100644 (file)
@@ -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
index b3fc0422d7bd07866dd367b535943a5b81c0900b..ad04613daf4d71c05e6952a433591c5aa6f7a333 100644 (file)
@@ -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)
 
index a88fcb747b15bfd0301862731cb4ce38e8d324a1..d75a604a1fcfc2f5250d7498f4572e7e6ead685b 100644 (file)
@@ -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 *