Skip to content

Commit 308433a

Browse files
gpsheadclaude
andcommitted
Remove incorrect RFC 4648 references from base85/ascii85
RFC 4648 only covers base16, base32, and base64. The canonical encoding concept applies to base85 but is not defined by that RFC. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 4b7c6ae commit 308433a

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

Modules/binascii.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,15 +1050,15 @@ binascii.a2b_ascii85
10501050
ignorechars: Py_buffer = b''
10511051
A byte string containing characters to ignore from the input.
10521052
canonical: bool = False
1053-
When set to true, reject non-canonical encodings per RFC 4648 section 3.5.
1053+
When set to true, reject non-canonical encodings.
10541054
10551055
Decode Ascii85 data.
10561056
[clinic start generated code]*/
10571057

10581058
static PyObject *
10591059
binascii_a2b_ascii85_impl(PyObject *module, Py_buffer *data, int foldspaces,
10601060
int adobe, Py_buffer *ignorechars, int canonical)
1061-
/*[clinic end generated code: output=09b35f1eac531357 input=75a0dcab97528ade]*/
1061+
/*[clinic end generated code: output=09b35f1eac531357 input=dd050604ed30199e]*/
10621062
{
10631063
const unsigned char *ascii_data = data->buf;
10641064
Py_ssize_t ascii_len = data->len;
@@ -1178,8 +1178,7 @@ binascii_a2b_ascii85_impl(PyObject *module, Py_buffer *data, int foldspaces,
11781178
*bin_data++ = (leftchar >> (24 - 8 * i)) & 0xff;
11791179
}
11801180

1181-
/* https://datatracker.ietf.org/doc/html/rfc4648.html#section-3.5
1182-
* Decoders MAY reject non-canonical encodings. */
1181+
/* Reject non-canonical encodings in the final group. */
11831182
if (canonical && chunk_len < 4) {
11841183
if (chunk_len == 0) {
11851184
state = get_binascii_state(module);
@@ -1367,7 +1366,7 @@ binascii.a2b_base85
13671366
ignorechars: Py_buffer = b''
13681367
A byte string containing characters to ignore from the input.
13691368
canonical: bool = False
1370-
When set to true, reject non-canonical encodings per RFC 4648 section 3.5.
1369+
When set to true, reject non-canonical encodings.
13711370
13721371
Decode a line of Base85 data.
13731372
[clinic start generated code]*/
@@ -1376,7 +1375,7 @@ static PyObject *
13761375
binascii_a2b_base85_impl(PyObject *module, Py_buffer *data,
13771376
PyBytesObject *alphabet, Py_buffer *ignorechars,
13781377
int canonical)
1379-
/*[clinic end generated code: output=90dfef0c6b51e5f3 input=fe3bb2d3a66b9842]*/
1378+
/*[clinic end generated code: output=90dfef0c6b51e5f3 input=2819dc8aeffee5a2]*/
13801379
{
13811380
const unsigned char *ascii_data = data->buf;
13821381
Py_ssize_t ascii_len = data->len;
@@ -1462,8 +1461,7 @@ binascii_a2b_base85_impl(PyObject *module, Py_buffer *data,
14621461
*bin_data++ = (leftchar >> (24 - 8 * i)) & 0xff;
14631462
}
14641463

1465-
/* https://datatracker.ietf.org/doc/html/rfc4648.html#section-3.5
1466-
* Decoders MAY reject non-canonical encodings. */
1464+
/* Reject non-canonical encodings in the final group. */
14671465
if (canonical && chunk_len < 4) {
14681466
if (chunk_len == 0) {
14691467
/* 1-char partial group is never produced by a conforming

Modules/clinic/binascii.c.h

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)