Skip to content

Commit 264e306

Browse files
committed
Restore logic where existance and directoriness are checked on realpath.
1 parent 3058faf commit 264e306

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Lib/pdb.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,15 +183,15 @@ class _ExecutableTarget:
183183

184184
class _ScriptTarget(_ExecutableTarget):
185185
def __init__(self, target):
186-
if not os.path.exists(target):
187-
print(f'Error: {target} does not exist')
186+
self._target = self._safe_realpath(target)
187+
188+
if not os.path.exists(self._target):
189+
print(f'Error: {self._target} does not exist')
188190
sys.exit(1)
189-
if os.path.isdir(target):
190-
print(f'Error: {target} is a directory')
191+
if os.path.isdir(self._target):
192+
print(f'Error: {self._target} is a directory')
191193
sys.exit(1)
192194

193-
self._target = self._safe_realpath(target)
194-
195195
# If PYTHONSAFEPATH (-P) is not set, sys.path[0] is the directory
196196
# of pdb, and we should replace it with the directory of the script
197197
if not sys.flags.safe_path:

0 commit comments

Comments
 (0)