Changeset: 53d1101f60ca for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=53d1101f60ca
Modified Files:
        clients/python/monetdb/mapi2.py
        clients/python/monetdb/mapi3.py
Branch: Jul2012
Log Message:

correctly close socket when mapi object is destroyed (unreported bug)


diffs (39 lines):

diff --git a/clients/python/monetdb/mapi2.py b/clients/python/monetdb/mapi2.py
--- a/clients/python/monetdb/mapi2.py
+++ b/clients/python/monetdb/mapi2.py
@@ -63,6 +63,7 @@ class Server:
     def __init__(self):
         self.state = STATE_INIT
         self._result = None
+        self.socket = None
 
     def connect(self, hostname, port, username, password, database, language):
         """ connect to a MonetDB database using the mapi protocol"""
@@ -259,3 +260,7 @@ class Server:
                 raise OperationalError(error[1])
             pos += length
 
+
+    def __del__(self):
+        if self.socket:
+            self.socket.close()
diff --git a/clients/python/monetdb/mapi3.py b/clients/python/monetdb/mapi3.py
--- a/clients/python/monetdb/mapi3.py
+++ b/clients/python/monetdb/mapi3.py
@@ -62,6 +62,7 @@ class Server:
     def __init__(self):
         self.state = STATE_INIT
         self._result = None
+        self.socket = None
 
     def connect(self, hostname, port, username, password, database, language):
         """ connect to a MonetDB database using the mapi protocol"""
@@ -265,3 +266,8 @@ class Server:
                 raise OperationalError(error[1])
             pos += length
 
+
+    def __del__(self):
+        if self.socket:
+            self.socket.close()
+
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to