From 4b369945d0bc380a8b111812ba2969c773792c9f Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Mon, 7 Nov 2016 16:58:25 -0800 Subject: [PATCH] Change struct fmt argument to str instead of AnyStr (#669) Switching between a bytes fmt and str fmt argument can cause a BytesWarning when running Python with the -b command line argument. --- stdlib/3/struct.pyi | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/stdlib/3/struct.pyi b/stdlib/3/struct.pyi index f41164eeb..f5396102d 100644 --- a/stdlib/3/struct.pyi +++ b/stdlib/3/struct.pyi @@ -2,25 +2,25 @@ # Based on http://docs.python.org/3.2/library/struct.html -from typing import overload, Any, AnyStr, Tuple +from typing import overload, Any, Tuple class error(Exception): ... -def pack(fmt: AnyStr, *v: Any) -> bytes: ... +def pack(fmt: str, *v: Any) -> bytes: ... # TODO buffer type -def pack_into(fmt: AnyStr, buffer: Any, offset: int, *v: Any) -> None: ... +def pack_into(fmt: str, buffer: Any, offset: int, *v: Any) -> None: ... # TODO buffer type -def unpack(fmt: AnyStr, buffer: Any) -> Tuple[Any, ...]: ... -def unpack_from(fmt: AnyStr, buffer: Any, offset: int = ...) -> Tuple[Any, ...]: ... +def unpack(fmt: str, buffer: Any) -> Tuple[Any, ...]: ... +def unpack_from(fmt: str, buffer: Any, offset: int = ...) -> Tuple[Any, ...]: ... -def calcsize(fmt: AnyStr) -> int: ... +def calcsize(fmt: str) -> int: ... class Struct: format = b'' size = 0 - def __init__(self, format: AnyStr) -> None: ... + def __init__(self, format: str) -> None: ... def pack(self, *v: Any) -> bytes: ... # TODO buffer type