8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9f4c4bb commit 5687c10Copy full SHA for 5687c10
.travis.yml
@@ -8,4 +8,4 @@ python:
8
- "3.6"
9
install:
10
- pip install .
11
-script: nosetests
+script: nosetests -v
io_chunks/chunks.py
@@ -6,6 +6,15 @@
6
)
7
+def memoryview_compat(bytes_, castTo='B'):
+ obj = memoryview(bytes_)
+ try:
12
+ obj.cast(castTo)
13
+ except AttributeError:
14
+ obj.format = castTo
15
+ return obj
16
+
17
18
class RawIOChunk(RawIOBase):
19
"""
20
An IO read-only object with access to a portion of another IO object.
@@ -65,7 +74,7 @@ def readinto(self, array):
65
74
remaining = self._size - self._cursor
66
75
if remaining <= 0:
67
76
return 0
68
- array = memoryview(array).cast('B')
77
+ array = memoryview_compat(array, 'B')
69
78
position = self._stream.tell()
70
79
self._stream.seek(self._start + self._cursor)
71
80
if len(array) > remaining:
0 commit comments