]> granicus.if.org Git - python/commitdiff
Fix a few ResourceWarnings in idle
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>
Mon, 3 Oct 2011 18:33:24 +0000 (20:33 +0200)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>
Mon, 3 Oct 2011 18:33:24 +0000 (20:33 +0200)
Lib/idlelib/configHandler.py
Lib/idlelib/rpc.py

index 73b8db5b23261bce4ab04724a27ed0eef41bcd14..79315ef63b898df6809321ef258f3880c2d8ef24 100644 (file)
@@ -145,7 +145,8 @@ class IdleUserConfParser(IdleConfParser):
             except IOError:
                 os.unlink(fname)
                 cfgFile = open(fname, 'w')
-            self.write(cfgFile)
+            with cfgFile:
+                self.write(cfgFile)
         else:
             self.RemoveFile()
 
index 0c56ccdcfe50532a7f6ac3ae7399acab99691132..53f4aa89da3ffe4fde121a558ab9798f8b3f7f61 100644 (file)
@@ -534,6 +534,10 @@ class RPCClient(SocketIO):
     def get_remote_proxy(self, oid):
         return RPCProxy(self, oid)
 
+    def close(self):
+        self.listening_sock.close()
+        SocketIO.close(self)
+
 class RPCProxy(object):
 
     __methods = None