Changeset: 7e21dcac7aec for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7e21dcac7aec
Modified Files:
python/monetdb/mapi3.py
Branch: default
Log Message:
fix the incomplete payload stuff also for python3
diffs (41 lines):
diff -r 1e3ffb91c857 -r 7e21dcac7aec python/monetdb/mapi3.py
--- a/python/monetdb/mapi3.py Fri May 21 15:49:19 2010 +0200
+++ b/python/monetdb/mapi3.py Fri May 21 15:53:52 2010 +0200
@@ -30,9 +30,15 @@
import logging
import struct
from io import BytesIO
+import platform
from monetdb.monetdb_exceptions import *
+# windows doesn't support MSG_WAITALL flag for recv
+flags = None
+if platform.system() != 'Windows':
+ flags = socket.MSG_WAITALL
+
logger = logging.getLogger("monetdb")
@@ -242,7 +248,11 @@
last = unpacked & 1
logger.debug("II: reading %i bytes" % length)
if length > 0:
- result_bytes.write(self.__getbytes(length))
+ count = length
+ while count > 0:
+ recv = self.__getbytes(length)
+ result_bytes.write(recv)
+ count -= len(recv)
result = result_bytes.getvalue()
logger.debug("RX: %s" % result)
@@ -252,7 +262,7 @@
def __getbytes(self, bytes):
"""Read an amount of bytes from the socket"""
try:
- return self.socket.recv(bytes)
+ return self.socket.recv(bytes, flags)
except socket.error as error_str:
raise OperationalError(error_str)
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list