[Lldb-commits] [lldb] r116486 - /lldb/trunk/scripts/Python/append-debugger-id.py

Johnny Chen johnny.chen at apple.com
Thu Oct 14 09:57:08 PDT 2010


Author: johnny
Date: Thu Oct 14 11:57:08 2010
New Revision: 116486

URL: http://llvm.org/viewvc/llvm-project?rev=116486&view=rev
Log:
Wrap the file writing operations inside a with statement to simplify code.

Modified:
    lldb/trunk/scripts/Python/append-debugger-id.py

Modified: lldb/trunk/scripts/Python/append-debugger-id.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/append-debugger-id.py?rev=116486&r1=116485&r2=116486&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/append-debugger-id.py (original)
+++ lldb/trunk/scripts/Python/append-debugger-id.py Thu Oct 14 11:57:08 2010
@@ -18,14 +18,6 @@
 
 # print "output_name is '" + output_name + "'"
 
-try:
-    f_out = open (output_name, 'a')
-except IOError:
-    print "Error:  Unable to open file for appending: " + output_name
-else:
-    f_out.write ("debugger_unique_id = 0\n");
-    f_out.write ("SBDebugger.Initialize()\n");
-    try:
-        f_out.close()
-    except IOError:
-        print "Error occurred while close file."
+with open(output_name, 'a') as f_out:
+    f_out.write("debugger_unique_id = 0\n")
+    f_out.write("SBDebugger.Initialize()\n")





More information about the lldb-commits mailing list