mirror of
https://github.com/python/cpython.git
synced 2026-01-04 14:32:21 +00:00
Provide curframe_locals for backward compatibility but deprecate it (#125951)
This commit is contained in:
parent
c1f352bf08
commit
29f8a67ae0
4 changed files with 21 additions and 1 deletions
|
|
@ -932,6 +932,14 @@ 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`` attribtue is now a deprecated
|
||||
read-only property. 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.
|
||||
(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`.)
|
||||
|
|
|
|||
11
Lib/pdb.py
11
Lib/pdb.py
|
|
@ -90,6 +90,7 @@
|
|||
from contextlib import contextmanager
|
||||
from rlcompleter import Completer
|
||||
from types import CodeType
|
||||
from warnings import deprecated
|
||||
|
||||
|
||||
class Restart(Exception):
|
||||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -226,7 +226,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
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
Deprecate ``pdb.Pdb.curframe_locals``
|
||||
Loading…
Add table
Add a link
Reference in a new issue