Commit a12f94bb authored by Ralf Schmitt's avatar Ralf Schmitt

fallback to buffer if memoryview fails in _get_memory on python 2.7

fixes "python2.7 array.array doesn't support memoryview used in
gevent.socket.send" issue
(http://code.google.com/p/gevent/issues/detail?id=94)
parent 47126b88
......@@ -226,8 +226,13 @@ if sys.version_info[:2] <= (2, 4):
if sys.version_info[:2] < (2, 7):
_get_memory = buffer
elif sys.version_info[:2] < (3, 0):
def _get_memory(string, offset):
try:
return memoryview(string)[offset:]
except TypeError:
return buffer(string, offset)
else:
def _get_memory(string, offset):
return memoryview(string)[offset:]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment