Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
205e75bb
Commit
205e75bb
authored
Feb 24, 2016
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #25913: Leading <~ is optional now in base64.a85decode() with adobe=True.
Patch by Swati Jaiswal.
parent
1827eff0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
6 deletions
+13
-6
Lib/base64.py
Lib/base64.py
+9
-4
Lib/test/test_base64.py
Lib/test/test_base64.py
+1
-2
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/base64.py
View file @
205e75bb
...
@@ -367,10 +367,15 @@ def a85decode(b, *, foldspaces=False, adobe=False, ignorechars=b' \t\n\r\v'):
...
@@ -367,10 +367,15 @@ def a85decode(b, *, foldspaces=False, adobe=False, ignorechars=b' \t\n\r\v'):
"""
"""
b
=
_bytes_from_decode_data
(
b
)
b
=
_bytes_from_decode_data
(
b
)
if
adobe
:
if
adobe
:
if
not
(
b
.
startswith
(
_A85START
)
and
b
.
endswith
(
_A85END
)):
if
not
b
.
endswith
(
_A85END
):
raise
ValueError
(
"Ascii85 encoded byte sequences must be bracketed "
raise
ValueError
(
"by {!r} and {!r}"
.
format
(
_A85START
,
_A85END
))
"Ascii85 encoded byte sequences must end "
b
=
b
[
2
:
-
2
]
# Strip off start/end markers
"with {!r}"
.
format
(
_A85END
)
)
if
b
.
startswith
(
_A85START
):
b
=
b
[
2
:
-
2
]
# Strip off start/end markers
else
:
b
=
b
[:
-
2
]
#
#
# We have to go through this stepwise, so as to ignore spaces and handle
# We have to go through this stepwise, so as to ignore spaces and handle
# special short sequences
# special short sequences
...
...
Lib/test/test_base64.py
View file @
205e75bb
...
@@ -494,6 +494,7 @@ class BaseXYTestCase(unittest.TestCase):
...
@@ -494,6 +494,7 @@ class BaseXYTestCase(unittest.TestCase):
eq
(
base64
.
a85decode
(
data
,
adobe
=
False
),
res
,
data
)
eq
(
base64
.
a85decode
(
data
,
adobe
=
False
),
res
,
data
)
eq
(
base64
.
a85decode
(
data
.
decode
(
"ascii"
),
adobe
=
False
),
res
,
data
)
eq
(
base64
.
a85decode
(
data
.
decode
(
"ascii"
),
adobe
=
False
),
res
,
data
)
eq
(
base64
.
a85decode
(
b'<~'
+
data
+
b'~>'
,
adobe
=
True
),
res
,
data
)
eq
(
base64
.
a85decode
(
b'<~'
+
data
+
b'~>'
,
adobe
=
True
),
res
,
data
)
eq
(
base64
.
a85decode
(
data
+
b'~>'
,
adobe
=
True
),
res
,
data
)
eq
(
base64
.
a85decode
(
'<~%s~>'
%
data
.
decode
(
"ascii"
),
adobe
=
True
),
eq
(
base64
.
a85decode
(
'<~%s~>'
%
data
.
decode
(
"ascii"
),
adobe
=
True
),
res
,
data
)
res
,
data
)
...
@@ -584,8 +585,6 @@ class BaseXYTestCase(unittest.TestCase):
...
@@ -584,8 +585,6 @@ class BaseXYTestCase(unittest.TestCase):
b"malformed"
,
adobe
=
True
)
b"malformed"
,
adobe
=
True
)
self
.
assertRaises
(
ValueError
,
base64
.
a85decode
,
self
.
assertRaises
(
ValueError
,
base64
.
a85decode
,
b"<~still malformed"
,
adobe
=
True
)
b"<~still malformed"
,
adobe
=
True
)
self
.
assertRaises
(
ValueError
,
base64
.
a85decode
,
b"also malformed~>"
,
adobe
=
True
)
# With adobe=False (the default), Adobe framing markers are disallowed
# With adobe=False (the default), Adobe framing markers are disallowed
self
.
assertRaises
(
ValueError
,
base64
.
a85decode
,
self
.
assertRaises
(
ValueError
,
base64
.
a85decode
,
...
...
Misc/NEWS
View file @
205e75bb
...
@@ -76,6 +76,9 @@ Core and Builtins
...
@@ -76,6 +76,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #25913: Leading ``<~`` is optional now in base64.a85decode() with
adobe=True. Patch by Swati Jaiswal.
- Issue #26186: Remove an invalid type check in importlib.util.LazyLoader.
- Issue #26186: Remove an invalid type check in importlib.util.LazyLoader.
- Issue #26367: importlib.__import__() raises SystemError like
- Issue #26367: importlib.__import__() raises SystemError like
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment