gh-141510: Use frozendict in the _opcode_metadata by vstinner · Pull Request #144910 · python/cpython
I know it's read by PyTorch for example, but I don't know if it's modified.
PyTorch uses the C API, include <internal/pycore_opcode_metadata.h> with NEED_OPCODE_METADATA macro defined: https://github.com/search?q=repo%3Apytorch%2Fpytorch%20_opcode_metadata&type=code
This internal header file declares data as read-only. Example: const struct opcode_metadata _PyOpcode_opcode_metadata[267], notice the const in the type.
However, do people use this in the wild or modify it in-place?
It sounds weird to me to modify _opcode_metadata dictionaries. Why would someone do that? You can easily create your own copy if you really need changes.