|
4 | 4 | from io import (
|
5 | 5 | RawIOBase, IOBase, SEEK_SET, SEEK_CUR, SEEK_END, UnsupportedOperation
|
6 | 6 | )
|
| 7 | +from six import integer_types |
7 | 8 |
|
8 | 9 |
|
9 | 10 | class RawIOChunk(RawIOBase):
|
@@ -38,12 +39,12 @@ def __init__(self, stream, size, start=None):
|
38 | 39 | raise ValueError("Buffer is not seekable")
|
39 | 40 | if stream.closed:
|
40 | 41 | raise ValueError("Buffer is closed")
|
41 |
| - if not isinstance(size, int): |
| 42 | + if not isinstance(size, integer_types): |
42 | 43 | raise TypeError("size: expected int, got {0!s}"
|
43 | 44 | .format(type(size)))
|
44 | 45 | if start is None:
|
45 | 46 | start = stream.tell()
|
46 |
| - elif not isinstance(start, int): |
| 47 | + elif not isinstance(start, integer_types): |
47 | 48 | raise TypeError("start: expected int, got {0!s}"
|
48 | 49 | .format(type(start)))
|
49 | 50 | self._start = start
|
@@ -84,9 +85,9 @@ def readinto(self, array):
|
84 | 85 | return read_size
|
85 | 86 |
|
86 | 87 | def seek(self, pos, whence=0):
|
87 |
| - if not isinstance(pos, int): |
| 88 | + if not isinstance(pos, integer_types): |
88 | 89 | raise TypeError("pos: expected int, got {0!s}".format(type(pos)))
|
89 |
| - if not isinstance(whence, int): |
| 90 | + if not isinstance(whence, integer_types): |
90 | 91 | raise TypeError("whence: expected int, got {0!s}"
|
91 | 92 | .format(type(whence)))
|
92 | 93 | if whence == SEEK_SET:
|
|
0 commit comments