From 0ebba82bfc4c766eb3b1c11f92d763d9eede7835 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Tue, 6 Nov 2018 18:24:16 +0000 Subject: [PATCH] Simplify base64 input and output parameters. (#2587) This allows passing bytearray() objects to the base64 encode and decode functions, on both Python 2.7 and 3.4. This also simplifies the code by ignoring 3.2 and 3.3, which are out of scope. --- stdlib/2and3/base64.pyi | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/stdlib/2and3/base64.pyi b/stdlib/2and3/base64.pyi index 70db6ad80..7c648c8b5 100644 --- a/stdlib/2and3/base64.pyi +++ b/stdlib/2and3/base64.pyi @@ -4,17 +4,11 @@ from typing import IO, Union, Text import sys if sys.version_info < (3,): - _encodable = Union[bytes, Text] - _decodable = Union[bytes, Text] -elif sys.version_info < (3, 3): - _encodable = bytes - _decodable = bytes -elif sys.version_info[:2] == (3, 3): + _encodable = Union[bytes, unicode] + _decodable = Union[bytes, unicode] +else: _encodable = bytes _decodable = Union[bytes, str] -elif sys.version_info >= (3, 4): - _encodable = Union[bytes, bytearray, memoryview] - _decodable = Union[bytes, bytearray, memoryview, str] def b64encode(s: _encodable, altchars: bytes = ...) -> bytes: ... def b64decode(s: _decodable, altchars: bytes = ...,