Bug report
Currently the signature of PyUnicodeWriter_WriteUCS4() is
int PyUnicodeWriter_WriteUCS4(PyUnicodeWriter *writer, const Py_UCS4 *str, Py_ssize_t size);
It requires a pointer to mutable buffer of Py_UCS4, even if it does not mutate it. This is a bug which prevents the use of PyUnicodeWriter_WriteUCS4() with immutable buffers of Py_UCS4.
We need simply to add const:
int PyUnicodeWriter_WriteUCS4(PyUnicodeWriter *writer, const Py_UCS4 *str, Py_ssize_t size);
Linked PRs