[pypy-svn] r61094 - in pypy/trunk/pypy/module/_codecs: . test

fijal at codespeak.net fijal at codespeak.net
Mon Jan 19 00:33:12 CET 2009


Author: fijal
Date: Mon Jan 19 00:33:09 2009
New Revision: 61094

Modified:
   pypy/trunk/pypy/module/_codecs/app_codecs.py
   pypy/trunk/pypy/module/_codecs/test/test_codecs.py
Log:
oops


Modified: pypy/trunk/pypy/module/_codecs/app_codecs.py
==============================================================================
--- pypy/trunk/pypy/module/_codecs/app_codecs.py	(original)
+++ pypy/trunk/pypy/module/_codecs/app_codecs.py	Mon Jan 19 00:33:09 2009
@@ -830,7 +830,7 @@
 #    /* Default to Latin-1 */
     if mapping == 'latin-1':
         import _codecs
-        return _codecs.latin_1_encode(p, errors)
+        return _codecs.latin_1_encode(p, errors)[0]
     if (size == 0):
         return ''
     inpos = 0
@@ -839,7 +839,7 @@
         #/* try to encode it */
         try:
             x = charmapencode_output(ord(p[inpos]), mapping)
-            res += [x]
+            res += x[0]
         except KeyError:
             x = unicode_call_errorhandler(errors, "charmap",
             "character maps to <undefined>", p, inpos, inpos+1, False)

Modified: pypy/trunk/pypy/module/_codecs/test/test_codecs.py
==============================================================================
--- pypy/trunk/pypy/module/_codecs/test/test_codecs.py	(original)
+++ pypy/trunk/pypy/module/_codecs/test/test_codecs.py	Mon Jan 19 00:33:09 2009
@@ -493,3 +493,10 @@
         res = "\x00\x00\x00\x00\x00".decode("unicode-internal", "test.hui")
         assert res == u"\u0000\u0001\u0000"
 
+    def test_charmap_encode(self):
+        assert 'xxx'.encode('charmap') == 'xxx'
+
+class TestDirect:
+    def test_charmap_encode(self):
+        from pypy.module._codecs.app_codecs import charmap_encode
+        assert charmap_encode('xxx') == ('xxx', 3)



More information about the Pypy-commit mailing list