Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Provide curframe_locals for backward compatibility but deprecate it #125951

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 8 commits into from
Feb 8, 2025

Conversation

gaogaotiantian
Copy link
Member

We removed pdb.Pdb.curframe_locals in #124369, but there are 3rd party libraries depending on it. We add it back but give a deprecation warning so we can really remove it in the future.

Copy link
Contributor

@ncoghlan ncoghlan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of suggestions inline for the exact deprecation warning wording, but I think we do need to mention this in NEWS and the What's New docs:

  1. It's a backwards compatibility fix relative to 3.13.0 and 3.14.0a1 (hence NEWS)
  2. It's a new deprecation warning relative to 3.12.x (hence inclusion in the What's New deprecation listings)

@gaogaotiantian
Copy link
Member Author

@ncoghlan I gave myself some vacation from CPython a few weeks ago. Now I'm picking up the unfinished stuff. I added the news to explain the deprecation.

gabifalk added a commit to gabifalk/gentoo that referenced this pull request Dec 17, 2024
The regression was detected by ipython's own testsuite.

This part of the IPython code is expected to break again with python 3.14,
because the curframe_locals attribute was removed in the PR cpython#124369.
However, there are plans to restore this attribute for backward compatibility in
PR cpython#125951 before the CPython 3.14 release.

Url: ipython/ipython#14598
Url: ipython/ipython@c1e945b
Url: python/cpython#124369
Url: python/cpython#125951
Url: ipython/ipython#14620
Closes: https://bugs.gentoo.org/946568
Signed-off-by: Gabi Falk <[email protected]>
gabifalk added a commit to gabifalk/gentoo that referenced this pull request Dec 17, 2024
The regression was detected by ipython's own testsuite.

This part of the IPython code is expected to break again with python 3.14,
because the curframe_locals attribute was removed in the PR cpython#124369.
However, there are plans to restore this attribute for backward compatibility in
PR cpython#125951 before the CPython 3.14 release.

Url: ipython/ipython#14598
Url: ipython/ipython@c1e945b
Url: python/cpython#124369
Url: python/cpython#125951
Url: ipython/ipython#14620
Closes: https://bugs.gentoo.org/946568
Signed-off-by: Gabi Falk <[email protected]>
gentoo-bot pushed a commit to gentoo/gentoo that referenced this pull request Dec 20, 2024
The regression was detected by ipython's own testsuite.

This part of the IPython code is expected to break again with python 3.14,
because the curframe_locals attribute was removed in the PR cpython#124369.
However, there are plans to restore this attribute for backward compatibility in
PR cpython#125951 before the CPython 3.14 release.

Url: ipython/ipython#14598
Url: ipython/ipython@c1e945b
Url: python/cpython#124369
Url: python/cpython#125951
Url: ipython/ipython#14620
Closes: https://bugs.gentoo.org/946568
Signed-off-by: Gabi Falk <[email protected]>
Closes: #39746
Signed-off-by: Sam James <[email protected]>
Copy link
Contributor

@ncoghlan ncoghlan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested wording adjustment for the What's New, but otherwise LGTM!

Comment on lines 616 to 618
The undocumented ``pdb.Pdb.curframe_locals`` is deprecated because with
PEP 667 we don't need to cache the locals anymore. Derived debuggers
should access ``pdb.Pdb.curframe.f_locals`` directly.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The undocumented ``pdb.Pdb.curframe_locals`` is deprecated because with
PEP 667 we don't need to cache the locals anymore. Derived debuggers
should access ``pdb.Pdb.curframe.f_locals`` directly.
The undocumented ``pdb.Pdb.curframe_locals`` attribute is now a deprecated read-only property
accessing ``pdb.Pdb.curframe.f_locals``. The low overhead dynamic frame locals access added in
Python 3.13 by PEP 667 means the frame locals cache reference previously stored in this attribute
is no longer needed. Derived debuggers should access ``pdb.Pdb.curframe.f_locals`` directly in
Python 3.13 and later versions.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct? Line 617 does not read like a correct sentence.

@gaogaotiantian gaogaotiantian enabled auto-merge (squash) February 8, 2025 23:13
@gaogaotiantian gaogaotiantian merged commit 29f8a67 into python:main Feb 8, 2025
39 checks passed
@gaogaotiantian gaogaotiantian deleted the add-back-curframe branch February 9, 2025 00:36
bretello added a commit to bretello/pdbpp that referenced this pull request Apr 18, 2025
bretello added a commit to bretello/pdbpp that referenced this pull request Apr 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants