On Sep 9, 2013 12:36 PM, <random...@fastmail.us> wrote: > > On Fri, Sep 6, 2013, at 13:04, Chris Angelico wrote: > > On Sat, Sep 7, 2013 at 2:59 AM, <random...@fastmail.us> wrote: > > > Incidentally, how does all this interact with ctypes unicode_buffers, > > > which slice as strings and must be UTF-16 on windows? This was fine > > > pre-FSR when unicode objects were UTF-16, but I'm not sure how it would > > > work now. > > > > That would be pre-FSR *with a Narrow build*, which was the default on > > Windows but not everywhere. But I don't know or use ctypes, so an > > answer to your actual question will have to come from someone else. > > I did a couple tests - it works as well as can be expected for reading, > but completely breaks for writing (due to sequence size checks not > matching)
Do you mean that it breaks when overwriting Python string object buffers, or when overwriting arbitrary C strings either received from C code or created with create_unicode_buffer? If the former, I think that is to be expected since ctypes ultimately can't know what is the actual type of the pointer it was handed -- much as in C, that's up to the programmer to get right. I also think it's very bad practice to be overwriting those anyway, since Python strings are supposed to be immutable. If the latter, that sounds like a bug in ctypes to me.
-- https://mail.python.org/mailman/listinfo/python-list