This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: memmove fails with unicode strings
Type: behavior Stage: resolved
Components: ctypes Versions: Python 2.6
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: theller Nosy List: eric.smith, theller, verigak
Priority: normal Keywords:

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)
>>> buf.raw

>>> buf = create_string_buffer('______')
>>> memmove(buf, u'SPAM', 4)
>>> buf.raw

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

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.
Date User Action Args
2022-04-11 14:56:51adminsetgithub: 50963
2009-08-17 01:17:01eric.smithsetresolution: not a bug
stage: resolved
2009-08-16 23:46:48verigaksetstatus: open -> closed

messages: + msg91654
2009-08-16 21:42:41eric.smithsetnosy: + eric.smith
messages: + msg91645
2009-08-16 21:32:52verigakcreate