[Python-checkins] r66985 - in sandbox/trunk/2to3: lib2to3/refactor.py test.py
benjamin.peterson
python-checkins at python.org
Mon Oct 20 23:43:46 CEST 2008
Author: benjamin.peterson
Date: Mon Oct 20 23:43:46 2008
New Revision: 66985
Log:
no need to use nested try, except, finally
Modified:
sandbox/trunk/2to3/lib2to3/refactor.py
sandbox/trunk/2to3/test.py
Modified: sandbox/trunk/2to3/lib2to3/refactor.py
==============================================================================
--- sandbox/trunk/2to3/lib2to3/refactor.py (original)
+++ sandbox/trunk/2to3/lib2to3/refactor.py Mon Oct 20 23:43:46 2008
@@ -363,10 +363,9 @@
self.log_error("Can't create %s: %s", filename, err)
return
try:
- try:
- f.write(new_text)
- except os.error, err:
- self.log_error("Can't write %s: %s", filename, err)
+ f.write(new_text)
+ except os.error, err:
+ self.log_error("Can't write %s: %s", filename, err)
finally:
f.close()
self.log_debug("Wrote changes to %s", filename)
Modified: sandbox/trunk/2to3/test.py
==============================================================================
--- sandbox/trunk/2to3/test.py (original)
+++ sandbox/trunk/2to3/test.py Mon Oct 20 23:43:46 2008
@@ -12,10 +12,10 @@
from sys import exit, argv
if "-h" in argv or "--help" in argv or len(argv) > 2:
- print "Usage: %s [-h] [test suite[.test class]]" %(argv[0])
- print "default : run all tests in lib2to3/tests/test_*.py"
- print "test suite: run tests in lib2to3/tests/<test suite>"
- print "test class : run tests in <test suite>.<test class>"
+ print("Usage: %s [-h] [test suite[.test class]]" %(argv[0]))
+ print("default : run all tests in lib2to3/tests/test_*.py")
+ print("test suite: run tests in lib2to3/tests/<test suite>")
+ print("test class : run tests in <test suite>.<test class>")
exit(1)
if len(argv) == 2:
@@ -23,7 +23,7 @@
for m in argv[1].split("."):
mod = getattr(mod, m, None)
if not mod:
- print "Error importing %s" %(m)
+ print("Error importing %s" %(m))
exit(1)
if argv[1].find(".") == -1:
More information about the Python-checkins
mailing list