Ronald Oussoren added the comment: Py_UNICODE is an typedef for wchar_t and that type is 4 bytes long:
>>> a.tobytes() b'h\x00\x00\x00e\x00\x00\x00l\x00\x00\x00l\x00\x00\x00o\x00\x00\x00 \x00\x00\x00w\x00\x00\x00o\x00\x00\x00r\x00\x00\x00l\x00\x00\x00d\x00\x00\x00' >>> a = array.array('u', 'bar') >>> a.tobytes() b'b\x00\x00\x00a\x00\x00\x00r\x00\x00\x00' >>> len(a.tobytes()) 12 >>> This is with a checkout that was created yesterday. The issue is not resolved, there now is no way to easily create a UCS2 buffer; while there was in earlier releases of Python (with the default narrow build) ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue15035> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com