Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Pick target depending on preconditions
  • Loading branch information
johnslavik committed Dec 7, 2025
commit 70507701b780edd9aa5a7d8b1dc047dd56356766
10 changes: 6 additions & 4 deletions Lib/pdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,15 +183,17 @@ class _ExecutableTarget:

class _ScriptTarget(_ExecutableTarget):
def __init__(self, target):
self._target = os.path.realpath(target)

if not os.path.exists(self._target):
if not os.path.exists(target):
Comment thread
jaraco marked this conversation as resolved.
print(f'Error: {target} does not exist')
sys.exit(1)
if os.path.isdir(self._target):
if os.path.isdir(target):
print(f'Error: {target} is a directory')
sys.exit(1)

# Be careful with realpath to support pseudofilesystems (GH-142315).
realpath = os.path.realpath(target)
self._target = realpath if os.path.exists(realpath) else target

# If safe_path(-P) is not set, sys.path[0] is the directory
# of pdb, and we should replace it with the directory of the script
if not sys.flags.safe_path:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Pdb can run scripts from pseudofiles. Patch by Bartosz Sławecki.
Loading