Skip to content

Commit ca70b6d

Browse files
committed
Deprecate curframe_locals
1 parent bb5652f commit ca70b6d

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

stdlib/@tests/stubtest_allowlists/py313.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ inspect._ParameterKind.description # Still exists, but stubtest can't see it
166166
typing\._SpecialForm.* # Super-special typing primitive
167167
typing\.LiteralString # Super-special typing primitive
168168

169+
# Don't always exist at runtime
170+
(pdb.Pdb.curframe_locals)?
169171

170172
# ==================================================================
171173
# Allowlist entries that cannot or should not be fixed; 3.11 to 3.13

stdlib/pdb.pyi

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ from linecache import _ModuleGlobals
88
from rlcompleter import Completer
99
from types import CodeType, FrameType, TracebackType
1010
from typing import IO, Any, ClassVar, Final, Literal, TypeVar
11-
from typing_extensions import ParamSpec, Self, TypeAlias
11+
from typing_extensions import ParamSpec, Self, TypeAlias, deprecated
1212

1313
__all__ = ["run", "pm", "Pdb", "runeval", "runctx", "runcall", "set_trace", "post_mortem", "help"]
1414
if sys.version_info >= (3, 14):
@@ -60,7 +60,15 @@ class Pdb(Bdb, Cmd):
6060
stack: list[tuple[FrameType, int]]
6161
curindex: int
6262
curframe: FrameType | None
63-
curframe_locals: Mapping[str, Any]
63+
if sys.version_info >= (3, 13):
64+
@property
65+
@deprecated("curframe_locals is deprecated. Derived debuggers should access pdb.Pdb.curframe.f_locals instead.")
66+
def curframe_locals(self) -> Mapping[str, Any]: ...
67+
@curframe_locals.setter
68+
@deprecated("curframe_locals is deprecated. Derived debuggers should access pdb.Pdb.curframe.f_locals instead.")
69+
def curframe_locals(self, value: Mapping[str, Any]) -> None: ...
70+
else:
71+
curframe_locals: Mapping[str, Any]
6472
if sys.version_info >= (3, 14):
6573
mode: _Mode | None
6674
colorize: bool

0 commit comments

Comments
 (0)