mirror of
https://github.com/python/cpython.git
synced 2025-09-21 16:10:33 +00:00
pdb.py, bdb.py, cmd.py: use __init__() instead of init()
This commit is contained in:
parent
5cfa5dfe97
commit
5ef74b8f8e
3 changed files with 14 additions and 10 deletions
|
@ -13,8 +13,10 @@ BdbQuit = 'bdb.BdbQuit' # Exception to give up completely
|
||||||
|
|
||||||
class Bdb: # Basic Debugger
|
class Bdb: # Basic Debugger
|
||||||
|
|
||||||
def init(self):
|
def __init__(self):
|
||||||
self.breaks = {}
|
self.breaks = {}
|
||||||
|
|
||||||
|
def init(self): # BW compat only
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def reset(self):
|
def reset(self):
|
||||||
|
@ -303,5 +305,5 @@ def bar(a):
|
||||||
def test():
|
def test():
|
||||||
import linecache
|
import linecache
|
||||||
linecache.checkcache()
|
linecache.checkcache()
|
||||||
t = Tdb().init()
|
t = Tdb()
|
||||||
t.run('import bdb; bdb.foo(10)')
|
t.run('import bdb; bdb.foo(10)')
|
||||||
|
|
|
@ -14,7 +14,7 @@ class Cmd:
|
||||||
self.identchars = IDENTCHARS
|
self.identchars = IDENTCHARS
|
||||||
self.lastcmd = ''
|
self.lastcmd = ''
|
||||||
|
|
||||||
def init(self):
|
def init(self): # BW compat only
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def cmdloop(self):
|
def cmdloop(self):
|
||||||
|
|
16
Lib/pdb.py
16
Lib/pdb.py
|
@ -12,10 +12,12 @@ import repr
|
||||||
|
|
||||||
class Pdb(bdb.Bdb, cmd.Cmd):
|
class Pdb(bdb.Bdb, cmd.Cmd):
|
||||||
|
|
||||||
def init(self):
|
def __init__(self):
|
||||||
self = bdb.Bdb.init(self)
|
bdb.Bdb.__init__(self)
|
||||||
self = cmd.Cmd.init(self)
|
cmd.Cmd.__init__(self)
|
||||||
self.prompt = '(Pdb) '
|
self.prompt = '(Pdb) '
|
||||||
|
|
||||||
|
def init(self): # BW compat only
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def reset(self):
|
def reset(self):
|
||||||
|
@ -277,19 +279,19 @@ class Pdb(bdb.Bdb, cmd.Cmd):
|
||||||
# Simplified interface
|
# Simplified interface
|
||||||
|
|
||||||
def run(statement):
|
def run(statement):
|
||||||
Pdb().init().run(statement)
|
Pdb().run(statement)
|
||||||
|
|
||||||
def runctx(statement, globals, locals):
|
def runctx(statement, globals, locals):
|
||||||
Pdb().init().runctx(statement, globals, locals)
|
Pdb().runctx(statement, globals, locals)
|
||||||
|
|
||||||
def runcall(*args):
|
def runcall(*args):
|
||||||
apply(Pdb().init().runcall, args)
|
apply(Pdb().runcall, args)
|
||||||
|
|
||||||
|
|
||||||
# Post-Mortem interface
|
# Post-Mortem interface
|
||||||
|
|
||||||
def post_mortem(t):
|
def post_mortem(t):
|
||||||
p = Pdb().init()
|
p = Pdb()
|
||||||
p.reset()
|
p.reset()
|
||||||
while t.tb_next <> None: t = t.tb_next
|
while t.tb_next <> None: t = t.tb_next
|
||||||
p.interaction(t.tb_frame, t)
|
p.interaction(t.tb_frame, t)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue