Skip to content

Commit 545a72f

Browse files
committed
pdb.py, bdb.py, cmd.py: use __init__() instead of init()
1 parent ef4f28d commit 545a72f

3 files changed

Lines changed: 14 additions & 10 deletions

File tree

Lib/bdb.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@
1313

1414
class Bdb: # Basic Debugger
1515

16-
def init(self):
16+
def __init__(self):
1717
self.breaks = {}
18+
19+
def init(self): # BW compat only
1820
return self
1921

2022
def reset(self):
@@ -303,5 +305,5 @@ def bar(a):
303305
def test():
304306
import linecache
305307
linecache.checkcache()
306-
t = Tdb().init()
308+
t = Tdb()
307309
t.run('import bdb; bdb.foo(10)')

Lib/cmd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def __init__(self):
1414
self.identchars = IDENTCHARS
1515
self.lastcmd = ''
1616

17-
def init(self):
17+
def init(self): # BW compat only
1818
return self
1919

2020
def cmdloop(self):

Lib/pdb.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@
1212

1313
class Pdb(bdb.Bdb, cmd.Cmd):
1414

15-
def init(self):
16-
self = bdb.Bdb.init(self)
17-
self = cmd.Cmd.init(self)
15+
def __init__(self):
16+
bdb.Bdb.__init__(self)
17+
cmd.Cmd.__init__(self)
1818
self.prompt = '(Pdb) '
19+
20+
def init(self): # BW compat only
1921
return self
2022

2123
def reset(self):
@@ -277,19 +279,19 @@ def print_stack_entry(self, frame_lineno):
277279
# Simplified interface
278280

279281
def run(statement):
280-
Pdb().init().run(statement)
282+
Pdb().run(statement)
281283

282284
def runctx(statement, globals, locals):
283-
Pdb().init().runctx(statement, globals, locals)
285+
Pdb().runctx(statement, globals, locals)
284286

285287
def runcall(*args):
286-
apply(Pdb().init().runcall, args)
288+
apply(Pdb().runcall, args)
287289

288290

289291
# Post-Mortem interface
290292

291293
def post_mortem(t):
292-
p = Pdb().init()
294+
p = Pdb()
293295
p.reset()
294296
while t.tb_next <> None: t = t.tb_next
295297
p.interaction(t.tb_frame, t)

0 commit comments

Comments
 (0)