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

Skip to content

Commit c629d34

Browse files
committed
* change default line numbers for 'list' in pdb.py
* changed eval() into getattr() in cmd.py * added dirname(), basename() and (dummy) normath() to macpath.py * renamed nntp.py to nntplib.py * Made string.index() compatible with strop.index() * Make string.atoi('') raise string.atoi_error rather than ValueError * Added dirname() and normpath() to posixpath.
1 parent 1115ab2 commit c629d34

7 files changed

Lines changed: 442 additions & 10 deletions

File tree

Lib/cmd.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def onecmd(self, line):
3737
return self.default(line)
3838
else:
3939
try:
40-
func = eval('self.do_' + cmd)
40+
func = getattr(self, 'do_' + cmd)
4141
except AttributeError:
4242
return self.default(line)
4343
return func(arg)
@@ -49,7 +49,7 @@ def do_help(self, arg):
4949
if arg:
5050
# XXX check arg syntax
5151
try:
52-
func = eval('self.help_' + arg)
52+
func = getattr(self, 'help_' + arg)
5353
except:
5454
print '*** No help on', `arg`
5555
return

Lib/macpath.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ def split(s):
4646
return s[:colon], s[colon:]
4747

4848

49+
# Short interfaces to split()
50+
51+
def dirname(s): return split(s)[0]
52+
def basename(s): return split(s)[1]
53+
54+
4955
# XXX This is undocumented and may go away!
5056
# Normalize a pathname: get rid of '::' sequences by backing up,
5157
# e.g., 'foo:bar::bletch' becomes 'foo:bletch'.
@@ -112,3 +118,9 @@ def exists(s):
112118
except mac.error:
113119
return 0
114120
return 1
121+
122+
123+
# Normalize path, removing things like ...:A:..:... (yet to be written)
124+
125+
def normpath(s):
126+
return s

0 commit comments

Comments
 (0)