Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Support multiline output in binascii.b2a_base64() and base64.b64encode() #143214

Copy link
Copy link
@serhiy-storchaka

Description

@serhiy-storchaka
Issue body actions

Feature or enhancement

According to RFC 4648, section 3.1:

Implementations MUST NOT add line feeds to base-encoded data unless
the specification referring to this document explicitly directs base
encoders to add line feeds after a specific number of characters.

But many specifications use Base 64 separated on lines of fixed length. The stdlib code contains multiple functions that take the Base 64 data and split it on multiple lines. It is worth to add a special support of this in the base functions that encode to Base 64 -- to improve maintenability (there is a known bug in email.base64mime.body_encode()), convenience and performance.

I choose name wrapcol for the parameter because it is already used in base64.a85encode(). Other (mostly private) functions that implement the Base 64 wrapping use different names: maxlinelen, maxlen, max_line_length. PR #102753 propose name width for binascii.b2a_ascii85() (it is also used in textwrap). So there is no consistency or single dominant option, but I am open for suggestions.

Linked PRs

Reactions are currently unavailable

Metadata

Metadata

Labels

3.15pre-release feature fixes, bugs and security fixespre-release feature fixes, bugs and security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.