From 4ca2bcf843337c8acf62a2d09afa6c02262320c7 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 7 Dec 2025 15:24:25 -0500 Subject: [PATCH] Restore logic where existance and directoriness are checked on realpath. --- Lib/pdb.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Lib/pdb.py b/Lib/pdb.py index a2930b5a8542..33ac6a13640f 100644 --- a/Lib/pdb.py +++ b/Lib/pdb.py @@ -183,15 +183,15 @@ class _ExecutableTarget: class _ScriptTarget(_ExecutableTarget): def __init__(self, target): - if not os.path.exists(target): + self._target = self._safe_realpath(target) + + if not os.path.exists(self._target): print(f'Error: {target} does not exist') sys.exit(1) - if os.path.isdir(target): + if os.path.isdir(self._target): print(f'Error: {target} is a directory') sys.exit(1) - self._target = self._safe_realpath(target) - # If PYTHONSAFEPATH (-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: -- 2.47.3