gh-118934: Fix PyEval_GetLocals docs (PEP 667) (#119932)

PEP 667's description of the planned changes to PyEval_GetLocals
was internally inconsistent when accepted, so the docs added for
gh-74929 didn't match either the current behaviour or the intended
behaviour once gh-118934 is fixed.

This PR updates the documentation and 3.13 What's New to match the
intended behaviour (once gh-118934 is fixed).

It also tidies up lingering references to `f_locals` always being a
dictionary (this hasn't been true since at least when custom
namespace support for class statement execution was added)
This commit is contained in:
Alyssa Coghlan 2024-06-02 14:44:29 +10:00 committed by GitHub
parent e378dc15b5
commit fd6cd621e0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 46 additions and 21 deletions

View file

@ -1347,13 +1347,13 @@ Special read-only attributes
``object.__getattr__`` with arguments ``obj`` and ``"f_code"``.
* - .. attribute:: frame.f_locals
- The dictionary used by the frame to look up
- The mapping used by the frame to look up
:ref:`local variables <naming>`.
If the frame refers to an :term:`optimized scope`,
this may return a write-through proxy object.
.. versionchanged:: 3.13
Return a proxy for functions and comprehensions.
Return a proxy for optimized scopes.
* - .. attribute:: frame.f_globals
- The dictionary used by the frame to look up