]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Restore logic where existance and directoriness are checked on realpath.
authorJason R. Coombs <jaraco@jaraco.com>
Sun, 7 Dec 2025 20:24:25 +0000 (15:24 -0500)
committerJason R. Coombs <jaraco@jaraco.com>
Sun, 7 Dec 2025 20:25:00 +0000 (15:25 -0500)
Lib/pdb.py

index a2930b5a85423654b94b5089a823fe0961a016cb..33ac6a13640f1f58e4383fac561e3f7fcc6eff1c 100644 (file)
@@ -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: