PEP 558: Fix mention of old locals() semantics (#1266)
When updating the PEP to specify independent snapshots for locals() at function scope, I missed this reference to the old semantics that returned a direct reference to the dynamic internal snapshot.
This commit is contained in:
parent
475d6cdf8c
commit
8dcf7fe49c
13
pep-0558.rst
13
pep-0558.rst
|
@ -290,11 +290,11 @@ defined ``locals()`` builtin, trace functions necessarily use the implementation
|
|||
dependent ``frame.f_locals`` interface, as a frame reference is what gets
|
||||
passed to hook implementations.
|
||||
|
||||
Instead of being a direct reference to the dynamic snapshot returned by
|
||||
``locals()``, ``frame.f_locals`` will be updated to instead return a dedicated
|
||||
proxy type (implemented as a private subclass of the existing
|
||||
``types.MappingProxyType``) that has two internal attributes not exposed as
|
||||
part of either the Python or public C API:
|
||||
Instead of being a direct reference to the internal dynamic snapshot used to
|
||||
populate the independent snapshots returned by ``locals()``, ``frame.f_locals``
|
||||
will be updated to instead return a dedicated proxy type (implemented as a
|
||||
private subclass of the existing ``types.MappingProxyType``) that has two
|
||||
internal attributes not exposed as part of the Python runtime API:
|
||||
|
||||
* *mapping*: an implicitly updated snapshot of the function local variables
|
||||
and closure references, as well as any arbitrary items that have been set via
|
||||
|
@ -302,6 +302,9 @@ part of either the Python or public C API:
|
|||
underlying frame
|
||||
* *frame*: the underlying frame that the snapshot is for
|
||||
|
||||
For backwards compatibility, the stored snapshot will continue to be made
|
||||
available through the public ``PyEval_GetLocals()`` C API.
|
||||
|
||||
``__getitem__`` operations on the proxy will read directly from the stored
|
||||
snapshot.
|
||||
|
||||
|
|
Loading…
Reference in New Issue