Feature or enhancement
Proposal:
CPython often sets the char *format member of a Py_buffer to a string literal such as "B". If an extension using the C API were to attempt to modify the string, the behavior would be undefined.
It is generally considered good practice to advertise that the string pointed to by format should not be mutated by giving it type const char *.
Has this already been discussed elsewhere?
I have already discussed this feature proposal on Discourse
Links to previous discussion of this feature:
https://discuss.python.org/t/can-py-buffer-format-be-const-qualified/108522
Linked PRs
Feature or enhancement
Proposal:
CPython often sets the
char *formatmember of aPy_bufferto a string literal such as"B". If an extension using the C API were to attempt to modify the string, the behavior would be undefined.It is generally considered good practice to advertise that the string pointed to by
formatshould not be mutated by giving it typeconst char *.Has this already been discussed elsewhere?
I have already discussed this feature proposal on Discourse
Links to previous discussion of this feature:
https://discuss.python.org/t/can-py-buffer-format-be-const-qualified/108522
Linked PRs
constqualifier toPy_buffer.format#155820