diff Modules/_codecsmodule.c @ 38586:9e0b050ce46f legacy-trunk

Patch #1359618: Speed-up charmap encoder.
author Martin v. Löwis <martin@v.loewis.de>
date Sun, 04 Jun 2006 19:36:28 +0000
parents 3fe3ccdf0155
children 549c547700af
line wrap: on
line diff
--- a/Modules/_codecsmodule.c	Sun Jun 04 17:17:25 2006 +0000
+++ b/Modules/_codecsmodule.c	Sun Jun 04 19:36:28 2006 +0000
@@ -792,6 +792,15 @@
     return v;
 }
 
+static PyObject*
+charmap_build(PyObject *self, PyObject *args)
+{
+    PyObject *map;
+    if (!PyArg_ParseTuple(args, "U:charmap_build", &map))
+        return NULL;
+    return PyUnicode_BuildEncodingMap(map);
+}
+
 #if defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T)
 
 static PyObject *
@@ -897,6 +906,7 @@
     {"ascii_decode", 		ascii_decode,			METH_VARARGS},
     {"charmap_encode", 		charmap_encode,			METH_VARARGS},
     {"charmap_decode", 		charmap_decode,			METH_VARARGS},
+    {"charmap_build", 		charmap_build,			METH_VARARGS},
     {"readbuffer_encode",	readbuffer_encode,		METH_VARARGS},
     {"charbuffer_encode",	charbuffer_encode,		METH_VARARGS},
 #if defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T)