buf = ctypes.create_unicode_buffer(2)
buf = "\ud800"
buf = "\udc01"
assert buf[:] == '\U00010001'
Works in CPython 3, fails with PyPy 3
Which OS did you test this on? CPython behaves like PyPy on my Linux machine.
This was on Windows 10. I’ll check again.
OK, turns out CPython behaves differently on Windows than it does on Linux in this case. I guess I should file a CPython bug?
I’ve filed https://bugs.python.org/issue39137
Feel free to close this.