Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

gh-74929: PEP 667 general docs update #119201

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
May 21, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add porting notes
  • Loading branch information
ncoghlan committed May 20, 2024
commit 6e3f1d1149a3dadda8752198abdfe8a6f871f8df
18 changes: 18 additions & 0 deletions 18 Doc/whatsnew/3.13.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2215,6 +2215,24 @@ Changes in the Python API
Calling it with argument ``2`` restores the current default behavior.
(Contributed by Serhiy Storchaka in :gh:`66410`.)

* Calling :func:`locals` in an :term:`optimised scope` now produces an
independent snapshot on each call, and hence no longer implicitly updates
previously returned references. Obtaining the legacy CPython behaviour now
requires explicit calls to update the initially returned dictionary with the
results of subsequent calls to ``locals()``. (Changed as part of :pep:`667`.)

* Calling :func:`locals` from a comprehension at module or class scope
(including via ``exec`` or ``eval``) once more behaves as if the comprehension
were running as an independent nested function (i.e. the local variables from
the containing scope are not included). In Python 3.12, this had changed
to include the local variables from the containing scope when implementing
:pep:`709`. (Changed as part of :pep:`667`.)

ncoghlan marked this conversation as resolved.
Show resolved Hide resolved
* Accessing :attr:`FrameType.f_locals <frame.f_locals>` in an
:term:`optimised scope` now returns a write-through proxy rather than a
snapshot that gets updated at ill-specified times. If a snapshot is desired,
it must be created explicitly with ``dict`` or the proxy's ``.copy()`` method.
(Changed as part of :pep:`667`.)

Changes in the C API
--------------------
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.