summaryrefslogtreecommitdiffstats
path: root/Modules/arraymodule.c
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2011-09-28 05:41:54 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2011-09-28 05:41:54 (GMT)
commitd63a3b8beb4a0841cb59fb3515347ccaab34b733 (patch)
tree3b4e3cc63151c5a5a910c3550a190aefaea96ad4 /Modules/arraymodule.c
parent48d49497c50e79d14e9df9527d766ca3a0a38be5 (diff)
downloadcpython-d63a3b8beb4a0841cb59fb3515347ccaab34b733.zip
cpython-d63a3b8beb4a0841cb59fb3515347ccaab34b733.tar.gz
cpython-d63a3b8beb4a0841cb59fb3515347ccaab34b733.tar.bz2
Implement PEP 393.
Diffstat (limited to 'Modules/arraymodule.c')
-rw-r--r--Modules/arraymodule.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c
index 8806bd5..9d49a97 100644
--- a/Modules/arraymodule.c
+++ b/Modules/arraymodule.c
@@ -2810,9 +2810,9 @@ PyMODINIT_FUNC
PyInit_array(void)
{
PyObject *m;
+ char buffer[PY_ARRAY_LENGTH(descriptors)], *p;
PyObject *typecodes;
Py_ssize_t size = 0;
- register Py_UNICODE *p;
struct arraydescr *descr;
if (PyType_Ready(&Arraytype) < 0)
@@ -2831,13 +2831,13 @@ PyInit_array(void)
size++;
}
- typecodes = PyUnicode_FromStringAndSize(NULL, size);
- p = PyUnicode_AS_UNICODE(typecodes);
+ p = buffer;
for (descr = descriptors; descr->typecode != '\0'; descr++) {
*p++ = (char)descr->typecode;
}
+ typecodes = PyUnicode_DecodeASCII(buffer, p - buffer, NULL);
- PyModule_AddObject(m, "typecodes", (PyObject *)typecodes);
+ PyModule_AddObject(m, "typecodes", typecodes);
if (PyErr_Occurred()) {
Py_DECREF(m);