Add mmap as a valid buffer type. (#2895)

This commit is contained in:
Alex Chamberlain
2019-03-30 17:47:30 +00:00
committed by Sebastian Rittau
parent d371513b80
commit f11d061849

View File

@@ -6,16 +6,17 @@
import sys
from typing import Any, Tuple, Text, Union, Iterator
from array import array
from mmap import mmap
class error(Exception): ...
_FmtType = Union[bytes, Text]
if sys.version_info >= (3,):
_BufferType = Union[array[int], bytes, bytearray, memoryview]
_WriteBufferType = Union[array, bytearray, memoryview]
_BufferType = Union[array[int], bytes, bytearray, memoryview, mmap]
_WriteBufferType = Union[array, bytearray, memoryview, mmap]
else:
_BufferType = Union[array[int], bytes, bytearray, buffer, memoryview]
_WriteBufferType = Union[array[Any], bytearray, buffer, memoryview]
_BufferType = Union[array[int], bytes, bytearray, buffer, memoryview, mmap]
_WriteBufferType = Union[array[Any], bytearray, buffer, memoryview, mmap]
def pack(fmt: _FmtType, *v: Any) -> bytes: ...
def pack_into(fmt: _FmtType, buffer: _WriteBufferType, offset: int, *v: Any) -> None: ...