From 20d9cdbd5f2c4de2a6bfa7d3ade8a5d74dfd8072 Mon Sep 17 00:00:00 2001 From: Christopher Cooper Date: Sat, 12 Aug 2017 20:00:45 +0000 Subject: [PATCH] binascii: Add required argument to .to_bytes(...) call. The .to_bytes(...) function requires two arguments. The first specifies the number of bytes to return, and the second specifies the endianness of those bytes. By definition, Base64 encoding is big endian. --- binascii/binascii.py | 2 +- binascii/metadata.txt | 2 +- binascii/setup.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/binascii/binascii.py b/binascii/binascii.py index 2b7cf6fe..dd6744c2 100644 --- a/binascii/binascii.py +++ b/binascii/binascii.py @@ -68,7 +68,7 @@ def a2b_base64(ascii): # if leftbits >= 8: leftbits -= 8 - res.append((leftchar >> leftbits).to_bytes(1)) + res.append((leftchar >> leftbits).to_bytes(1, 'big')) leftchar &= ((1 << leftbits) - 1) # last_char_was_a_pad = False diff --git a/binascii/metadata.txt b/binascii/metadata.txt index e389e185..917f31ce 100644 --- a/binascii/metadata.txt +++ b/binascii/metadata.txt @@ -1,3 +1,3 @@ srctype=pypy type=module -version = 2.4.0-4 +version = 2.4.0-5 diff --git a/binascii/setup.py b/binascii/setup.py index 164fcde3..63756cc5 100644 --- a/binascii/setup.py +++ b/binascii/setup.py @@ -7,7 +7,7 @@ sys.path.append("..") import optimize_upip setup(name='micropython-binascii', - version='2.4.0-4', + version='2.4.0-5', description='PyPy binascii module ported to MicroPython', long_description='This is a module ported from PyPy standard library to be compatible with\nMicroPython interpreter. Usually, this means applying small patches for\nfeatures not supported (yet, or at all) in MicroPython. Sometimes, heavier\nchanges are required. Note that CPython modules are written with availability\nof vast resources in mind, and may not work for MicroPython ports with\nlimited heap. If you are affected by such a case, please help reimplement\nthe module from scratch.', url='https://github.com/micropython/micropython-lib',