Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

base64.b64decode error raised on valid input #145968

Closed
Assignees
serhiy-storchaka
Labels
3.15new features, bugs and security fixesstdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error
@mayeut

Description

@mayeut

Bug report

Bug description:

An error is raised for the following valid test cases using the newly introducedignorechars parameter

importbase64assertbase64.b64decode(b'/----',altchars=b'-+',ignorechars=b'/')==b'\xfb\xef\xbe'assertbase64.b64decode(b'+----',altchars=b'/-',ignorechars=b'+')==b'\xff\xff\xff'

For both we get:

binascii.Error: Invalid base64-encoded string: number of data characters (5) cannot be 1 more than a multiple of 4

In both cases, the leading byte should be ignored thus giving a 4 bytes valid input.

CPython versions tested on:

CPython main branch

Operating systems tested on:

macOS

Linked PRs

Metadata

Metadata

Labels

3.15new features, bugs and security fixesstdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2026 Movatter.jp