mirror of
https://github.com/python/cpython.git
synced 2025-10-09 08:31:26 +00:00
Fix most trivially-findable print statements.
There's one major and one minor category still unfixed: doctests are the major category (and I hope to be able to augment the refactoring tool to refactor bona fide doctests soon); other code generating print statements in strings is the minor category. (Oh, and I don't know if the compiler package works.)
This commit is contained in:
parent
452bf519a7
commit
be19ed77dd
331 changed files with 2567 additions and 2648 deletions
28
Lib/bdb.py
28
Lib/bdb.py
|
@ -58,7 +58,7 @@ class Bdb:
|
|||
return self.trace_dispatch
|
||||
if event == 'c_return':
|
||||
return self.trace_dispatch
|
||||
print 'bdb.Bdb.dispatch: unknown debugging event:', repr(event)
|
||||
print('bdb.Bdb.dispatch: unknown debugging event:', repr(event))
|
||||
return self.trace_dispatch
|
||||
|
||||
def dispatch_line(self, frame):
|
||||
|
@ -483,17 +483,17 @@ class Breakpoint:
|
|||
disp = disp + 'yes '
|
||||
else:
|
||||
disp = disp + 'no '
|
||||
print >>out, '%-4dbreakpoint %s at %s:%d' % (self.number, disp,
|
||||
self.file, self.line)
|
||||
print('%-4dbreakpoint %s at %s:%d' % (self.number, disp,
|
||||
self.file, self.line), file=out)
|
||||
if self.cond:
|
||||
print >>out, '\tstop only if %s' % (self.cond,)
|
||||
print('\tstop only if %s' % (self.cond,), file=out)
|
||||
if self.ignore:
|
||||
print >>out, '\tignore next %d hits' % (self.ignore)
|
||||
print('\tignore next %d hits' % (self.ignore), file=out)
|
||||
if (self.hits):
|
||||
if (self.hits > 1): ss = 's'
|
||||
else: ss = ''
|
||||
print >>out, ('\tbreakpoint already hit %d time%s' %
|
||||
(self.hits, ss))
|
||||
print(('\tbreakpoint already hit %d time%s' %
|
||||
(self.hits, ss)), file=out)
|
||||
|
||||
# -----------end of Breakpoint class----------
|
||||
|
||||
|
@ -582,27 +582,27 @@ class Tdb(Bdb):
|
|||
def user_call(self, frame, args):
|
||||
name = frame.f_code.co_name
|
||||
if not name: name = '???'
|
||||
print '+++ call', name, args
|
||||
print('+++ call', name, args)
|
||||
def user_line(self, frame):
|
||||
import linecache
|
||||
name = frame.f_code.co_name
|
||||
if not name: name = '???'
|
||||
fn = self.canonic(frame.f_code.co_filename)
|
||||
line = linecache.getline(fn, frame.f_lineno)
|
||||
print '+++', fn, frame.f_lineno, name, ':', line.strip()
|
||||
print('+++', fn, frame.f_lineno, name, ':', line.strip())
|
||||
def user_return(self, frame, retval):
|
||||
print '+++ return', retval
|
||||
print('+++ return', retval)
|
||||
def user_exception(self, frame, exc_stuff):
|
||||
print '+++ exception', exc_stuff
|
||||
print('+++ exception', exc_stuff)
|
||||
self.set_continue()
|
||||
|
||||
def foo(n):
|
||||
print 'foo(', n, ')'
|
||||
print('foo(', n, ')')
|
||||
x = bar(n*10)
|
||||
print 'bar returned', x
|
||||
print('bar returned', x)
|
||||
|
||||
def bar(a):
|
||||
print 'bar(', a, ')'
|
||||
print('bar(', a, ')')
|
||||
return a/2
|
||||
|
||||
def test():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue