Skip to content

Document minimum wrapcol of 2 for a85encode with adobe=True #158774

Description

@augusto-rehfeldt

Bug report

Bug description:

Documented behaviour: The a85encode docstring states: "If wrapcol is non-zero, insert a newline (b'\n') character after at most every wrapcol characters."

Expected: Document that adobe=True uses an effective wrapcol of at least 2; retain intact Adobe delimiters.

Actual: b'<\n>' has two lines of length 2 despite wrapcol=1.

import base64

b, wrapcol = b'', 1
if not isinstance(b, bytes) or not isinstance(wrapcol, int) or wrapcol <= 0:
    print("REFUTATION REJECTED: invalid input")
else:
    actual = base64.a85encode(b, wrapcol=wrapcol, adobe=True)
    raw = b'<~~>'  # Empty payload, independently framed with Adobe markers.
    expected = b'\n'.join(raw[i:i + wrapcol] for i in range(0, len(raw), wrapcol))
    if any(len(line) > wrapcol for line in actual.split(b'\n')):
        print("REFUTATION CONFIRMED:", (b, wrapcol), "actual:", actual, "expected:", expected)
    else:
        print("REFUTATION REJECTED: every line satisfies wrapcol")

Output on Python 3.14.6 (Windows-11-10.0.26220-SP0), standard library base64:

REFUTATION CONFIRMED: (b'', 1) actual: b'<~\n~>' expected: b'<\n~\n~\n>'

This report was found and written by an automated property-testing tool I run (bugforge). The reproducer above was executed and its output is pasted unedited; no person reviewed the report before it was filed. The search script is in https://github.com/augusto-rehfeldt/bugforge-results/tree/main/base64-20261003-020052-c3

CPython versions tested on:

3.14

Operating systems tested on:

Windows

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions