FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-95913: make the new internal classes pdb.ModuleTarget/ScriptTarget private by iritkatriel · Pull Request #96053 · python/cpython · GitHub

/ cpython Public
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
8 changes: 4 additions & 4 deletions Lib/pdb.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def __repr__(self):
return self


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


class ModuleTarget(str):
class _ModuleTarget(str):
def check(self):
try:
self._details
Expand Down Expand Up @@ -1625,7 +1625,7 @@ def lookupmodule(self, filename):
return fullname
return None

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

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

target.check()
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_pyclbr.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def test_others(self):
cm(
'pdb',
# pyclbr does not handle elegantly `typing` or properties
ignore=('Union', 'ModuleTarget', 'ScriptTarget'),
ignore=('Union', '_ModuleTarget', '_ScriptTarget'),
)
cm('pydoc', ignore=('input', 'output',)) # properties

Expand Down

Back | FazBrowse Home | New Git URL