Issue 6714: memmove fails with unicode strings (original) (raw)

Issue6714

Created on 2009-08-16 21:32 by verigak, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg91644 - (view) Author: Giorgos Verigakis (verigak) Date: 2009-08-16 21:32
A demonstration: >>> buf = create_string_buffer('______') >>> memmove(buf, 'SPAM', 4) 614584 >>> buf.raw 'SPAM__\x00' >>> buf = create_string_buffer('______') >>> memmove(buf, u'SPAM', 4) 614672 >>> buf.raw 'S\x00\x00\x00__\x00' FWIW memmove fails in Python 3.0 too.
msg91645 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2009-08-16 21:42
What platform is this on? For a ucs4 platform, that is what I'd expect the result to be. Check sys.maxunicode to see if you have a ucs2 or ucs4 build. What do you expect as the result? Remember that memmove takes a count of bytes, not a character count.
msg91654 - (view) Author: Giorgos Verigakis (verigak) Date: 2009-08-16 23:46
Yes, you are right. I thought that the different behavior was weird. Sorry this is not a bug.
History
Date User Action Args
2022-04-11 14:56:51 admin set github: 50963
2009-08-17 01:17:01 eric.smith set resolution: not a bugstage: resolved
2009-08-16 23:46:48 verigak set status: open -> closedmessages: +
2009-08-16 21:42:41 eric.smith set nosy: + eric.smithmessages: +
2009-08-16 21:32:52 verigak create