Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
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
6 changes: 6 additions & 0 deletions Doc/whatsnew/3.14.rst
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,12 @@ Deprecated
write new code. The :mod:`subprocess` module is recommended instead.
(Contributed by Victor Stinner in :gh:`120743`.)

* :mod:`pdb`:
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.

(Contributed by Tian Gao in :gh:`124369` and :gh:`125951`.)

* :mod:`symtable`:
Deprecate :meth:`symtable.Class.get_methods` due to the lack of interest.
(Contributed by Bénédikt Tran in :gh:`119698`.)
Expand Down
11 changes: 11 additions & 0 deletions Lib/pdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
from contextlib import contextmanager
from rlcompleter import Completer
from types import CodeType
from warnings import deprecated


class Restart(Exception):
Expand Down Expand Up @@ -421,6 +422,16 @@ def setup(self, f, tb):
]
self.rcLines = []

@property
@deprecated("The frame locals reference is no longer cached. Use 'curframe.f_locals' instead.")
def curframe_locals(self):
return self.curframe.f_locals

@curframe_locals.setter
@deprecated("Setting 'curframe_locals' no longer has any effect. Update the contents of 'curframe.f_locals' instead.")
def curframe_locals(self, value):
pass

# Override Bdb methods

def user_call(self, frame, argument_list):
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_pyclbr.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def test_others(self):
cm(
'pdb',
# pyclbr does not handle elegantly `typing` or properties
ignore=('Union', '_ModuleTarget', '_ScriptTarget', '_ZipTarget'),
ignore=('Union', '_ModuleTarget', '_ScriptTarget', '_ZipTarget', 'curframe_locals'),
)
cm('pydoc', ignore=('input', 'output',)) # properties

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Deprecate ``pdb.Pdb.curframe_locals``
Loading