Skip to content

Commit 20d9cdb

Browse files
ccooper21pfalcon
authored andcommitted
binascii: Add required argument to <int>.to_bytes(...) call.
The <int>.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.
1 parent 96c981b commit 20d9cdb

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

binascii/binascii.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def a2b_base64(ascii):
6868
#
6969
if leftbits >= 8:
7070
leftbits -= 8
71-
res.append((leftchar >> leftbits).to_bytes(1))
71+
res.append((leftchar >> leftbits).to_bytes(1, 'big'))
7272
leftchar &= ((1 << leftbits) - 1)
7373
#
7474
last_char_was_a_pad = False

binascii/metadata.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
srctype=pypy
22
type=module
3-
version = 2.4.0-4
3+
version = 2.4.0-5

binascii/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import optimize_upip
88

99
setup(name='micropython-binascii',
10-
version='2.4.0-4',
10+
version='2.4.0-5',
1111
description='PyPy binascii module ported to MicroPython',
1212
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.',
1313
url='https://github.com/micropython/micropython-lib',

0 commit comments

Comments
 (0)