From: Amaury Forgeot d'Arc Date: Mon, 3 Oct 2011 18:33:24 +0000 (+0200) Subject: Fix a few ResourceWarnings in idle X-Git-Tag: v3.3.0a1~1304 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bbe7b0ad2a4bc34e5f9ef3b26653ed5c2642d319;p=thirdparty%2FPython%2Fcpython.git Fix a few ResourceWarnings in idle --- diff --git a/Lib/idlelib/configHandler.py b/Lib/idlelib/configHandler.py index 73b8db5b2326..79315ef63b89 100644 --- a/Lib/idlelib/configHandler.py +++ b/Lib/idlelib/configHandler.py @@ -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() diff --git a/Lib/idlelib/rpc.py b/Lib/idlelib/rpc.py index 0c56ccdcfe50..53f4aa89da3f 100644 --- a/Lib/idlelib/rpc.py +++ b/Lib/idlelib/rpc.py @@ -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