mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Run 2to3 over the Demo/ directory to shut up parse errors from 2to3 about lingering print statements.
This commit is contained in:
parent
a8c360ee76
commit
6f2df4d5e1
132 changed files with 1070 additions and 1080 deletions
|
@ -143,7 +143,7 @@ def fix(filename):
|
|||
# First copy the file's mode to the temp file
|
||||
try:
|
||||
statbuf = os.stat(filename)
|
||||
os.chmod(tempname, statbuf[ST_MODE] & 07777)
|
||||
os.chmod(tempname, statbuf[ST_MODE] & 0o7777)
|
||||
except os.error as msg:
|
||||
err('%s: warning: chmod failed (%r)\n' % (tempname, msg))
|
||||
# Then make a backup of the original file as filename~
|
||||
|
@ -176,22 +176,22 @@ def fixline(line):
|
|||
j = tokenprog.match(line, i)
|
||||
if j < 0:
|
||||
# A bad token; forget about the rest of this line
|
||||
print '(Syntax error:)'
|
||||
print line,
|
||||
print('(Syntax error:)')
|
||||
print(line, end=' ')
|
||||
return line
|
||||
a, b = tokenprog.regs[3] # Location of the token proper
|
||||
token = line[a:b]
|
||||
i = i+j
|
||||
if stack and token == stack[-1]:
|
||||
del stack[-1]
|
||||
elif match.has_key(token):
|
||||
elif token in match:
|
||||
stack.append(match[token])
|
||||
elif token == '=' and stack:
|
||||
line = line[:a] + '==' + line[b:]
|
||||
i, n = a + len('=='), len(line)
|
||||
elif token == '==' and not stack:
|
||||
print '(Warning: \'==\' at top level:)'
|
||||
print line,
|
||||
print('(Warning: \'==\' at top level:)')
|
||||
print(line, end=' ')
|
||||
return line
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue