Skip to content

Do not use assert for input validation in the base64 module #148153

@serhiy-storchaka

Description

@serhiy-storchaka

Bug report

Some functions in the base64 module used assert to check parameters. This is a bad practice, because in best case you will get different exceptions for invalid parameter values depending on the -O level. In worst case you can get incorrect result.

Most of such asserts were recently removed, but the one in base64.b32encode() was left.

This behavior was documented, so we do not need to backport the change.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    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