Patches item #1770355, was opened at 2007-08-08 21:51 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1770355&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Library (Lib) Group: Python 3000 Status: Open Resolution: None Priority: 5 Private: No Submitted By: STINNER Victor (haypo) Assigned to: Nobody/Anonymous (nobody) Summary: ctypes: c_char now uses bytes and not str (unicode) Initial Comment: Hi, I hear Guido's request to fix last py3k-struni bugs. I downloaded subversion trunk and started to work on ctypes tests. The problem is that ctypes c_char (and c_char_p) creates unicode string instead of byte string. I attached a proposition (patch) to change this behaviour (use bytes for c_char). So in next example, it will display 'bytes' and not 'str': from ctypes import c_buffer, c_char buf = c_buffer("abcdef") print (type(buf[0])) Other behaviour changes: - repr(c_char) adds a "b". Eg. repr(c_char('x')) is "c_char(b'x')" instead of "c_char('x')" - bytes is mutable whereas str is not: this may break some modules based on ctypes Victor Stinner aka haypo ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1770355&group_id=5470 _______________________________________________ Patches mailing list Patches@python.org http://mail.python.org/mailman/listinfo/patches