From f11d061849c89a8e28809e52b71a80f0e329cb7d Mon Sep 17 00:00:00 2001 From: Alex Chamberlain Date: Sat, 30 Mar 2019 17:47:30 +0000 Subject: [PATCH] Add mmap as a valid buffer type. (#2895) --- stdlib/2and3/struct.pyi | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/stdlib/2and3/struct.pyi b/stdlib/2and3/struct.pyi index c3e616d20..83036b6fa 100644 --- a/stdlib/2and3/struct.pyi +++ b/stdlib/2and3/struct.pyi @@ -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: ...