PEP 558: Defined semantics for locals()

I’ve merged the PEP updates that define a broader stable C API that allows extentions module to choose between the Python level semantics, consistent scope independent semantics, and a query API that lets the extension module decide for itself how to handle the differences.

While the reference implementation still needs work before we could considering merging it, I think it’s sufficiently complete to prove the viability of the core ideas in the PEP (the missing pieces are things like expanding the write-through proxy to implement the full mapping API, and actually implementing the view APIs, which definitely need to be done as part of the full implementation, but aren’t technically risky at all - we just need to refactor some existing code in CPython so we can re-use it for this new purpose).

I’m happy to accept further feedback on the latest version of the PEP here, but I’m also going to check directly with Nathaniel as to when he thinks he might be available to review it for pronouncement.