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

Skip to content

Commit 1f00eed

Browse files
committed
Feature added by Harri Pasanen (at my suggestion): .py suffix on
filename may be omitted.
1 parent 1ee36ff commit 1f00eed

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

Lib/pdb.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -421,19 +421,21 @@ def help_b(self):
421421
422422
The line number may be prefixed with a filename and a colon,
423423
to specify a breakpoint in another file (probably one that
424-
hasn't been loaded yet). The file is searched on sys.path."""
424+
hasn't been loaded yet). The file is searched on sys.path;
425+
the .py suffix may be omitted."""
425426

426427
def help_clear(self):
427428
self.help_cl()
428429

429430
def help_cl(self):
430-
print """cl(ear) [lineno]
431+
print """cl(ear) [file:][lineno]
431432
With a line number argument, clear that break in the current file.
432433
Without argument, clear all breaks (but first ask confirmation).
433434
434435
The line number may be prefixed with a filename and a colon,
435436
to specify a breakpoint in another file (probably one that
436-
hasn't been loaded yet). The file is searched on sys.path."""
437+
hasn't been loaded yet). The file is searched on sys.path;
438+
the .py suffix may be omitted."""
437439

438440
def help_step(self):
439441
self.help_s()
@@ -517,6 +519,11 @@ def help_pdb(self):
517519
def lookupmodule(self, filename):
518520
if filename == mainmodule:
519521
return mainpyfile
522+
root, ext = os.path.splitext(filename)
523+
if ext == '':
524+
filename = filename + '.py'
525+
if os.path.isabs(filename):
526+
return filename
520527
for dirname in sys.path:
521528
fullname = os.path.join(dirname, filename)
522529
if os.path.exists(fullname):

0 commit comments

Comments
 (0)