Skip to content

Commit 1a720c6

Browse files
authored
gh-95913: make the new internal classes pdb.ModuleTarget/ScriptTarget private (GH-96053)
1 parent 4a6fa89 commit 1a720c6

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Diff for: Lib/pdb.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def __repr__(self):
131131
return self
132132

133133

134-
class ScriptTarget(str):
134+
class _ScriptTarget(str):
135135
def __new__(cls, val):
136136
# Mutate self to be the "real path".
137137
res = super().__new__(cls, os.path.realpath(val))
@@ -167,7 +167,7 @@ def code(self):
167167
return f"exec(compile({fp.read()!r}, {self!r}, 'exec'))"
168168

169169

170-
class ModuleTarget(str):
170+
class _ModuleTarget(str):
171171
def check(self):
172172
try:
173173
self._details
@@ -1625,7 +1625,7 @@ def lookupmodule(self, filename):
16251625
return fullname
16261626
return None
16271627

1628-
def _run(self, target: Union[ModuleTarget, ScriptTarget]):
1628+
def _run(self, target: Union[_ModuleTarget, _ScriptTarget]):
16291629
# When bdb sets tracing, a number of call and line events happen
16301630
# BEFORE debugger even reaches user's code (and the exact sequence of
16311631
# events depends on python version). Take special measures to
@@ -1789,7 +1789,7 @@ def main():
17891789
commands = [optarg for opt, optarg in opts if opt in ['-c', '--command']]
17901790

17911791
module_indicated = any(opt in ['-m'] for opt, optarg in opts)
1792-
cls = ModuleTarget if module_indicated else ScriptTarget
1792+
cls = _ModuleTarget if module_indicated else _ScriptTarget
17931793
target = cls(args[0])
17941794

17951795
target.check()

Diff for: Lib/test/test_pyclbr.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ def test_others(self):
229229
cm(
230230
'pdb',
231231
# pyclbr does not handle elegantly `typing` or properties
232-
ignore=('Union', 'ModuleTarget', 'ScriptTarget'),
232+
ignore=('Union', '_ModuleTarget', '_ScriptTarget'),
233233
)
234234
cm('pydoc', ignore=('input', 'output',)) # properties
235235

0 commit comments

Comments
 (0)