util: make buffer readonly
There is no use of writable buffers anywhere in the code, and this helps us
make sure we don't get into unsound territory when sharing memory with Rust.
This `toreadonly` method was not available in Python 3.6, but we dropped the
support for it earlier that week, so no need for any compatibility code.
# So GitLab doesn't think we're using tons of Perl
*.t -linguist-detectable