Bugs item #1646630, was opened at 2007-01-28 23:18 Message generated for change (Settings changed) made by theller You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1646630&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: Extension Modules Group: Python 2.5 Status: Open Resolution: None Priority: 5 Private: No Submitted By: Johannes Hölzl (johannes) >Assigned to: Thomas Heller (theller) Summary: ctypes.string_at(buf, 0) is seen as zero-terminated-string Initial Comment: ctypes.string_at() interprets size=0 wrong. When the size argument is 0, ctypes.string_at (and probably wstring_at too) string_at tries to read an zero-terminated string instead of an empty string. Python 2.5 (r25:51908, Oct 6 2006, 15:22:41) [GCC 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu4)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from ctypes import * >>> bytes = (c_char*3)("1", "2", "\0") >>> string_at(pointer(bytes)) '12' >>> string_at(pointer(bytes), 0) '12' >>> string_at(pointer(bytes), 1) '1' instead of: >>> string_at(pointer(bytes), 0) '' ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1646630&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com