Skip to content

Commit 3a92fce

Browse files
committed
Improve import time of the base64 module.
Importing `base64` is now up to six times faster. The `re` module is now locally imported by `base64.b16decode` and is no more implicitly exposed as `base64.re`.
1 parent aef52ca commit 3a92fce

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Lib/base64.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
# Modified 30-Dec-2003 by Barry Warsaw to add full RFC 3548 support
55
# Modified 22-May-2007 by Guido van Rossum to use bytes everywhere
66

7-
import re
87
import struct
98
import binascii
109

@@ -281,6 +280,8 @@ def b16decode(s, casefold=False):
281280
s is incorrectly padded or if there are non-alphabet characters present
282281
in the input.
283282
"""
283+
import re
284+
284285
s = _bytes_from_decode_data(s)
285286
if casefold:
286287
s = s.upper()

0 commit comments

Comments
 (0)