-
-
Notifications
You must be signed in to change notification settings - Fork 34.4k
Do not use assert for input validation in the base64 module #148153
Copy link
Copy link
Closed
Labels
3.15new features, bugs and security fixesnew features, bugs and security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
3.15new features, bugs and security fixesnew features, bugs and security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error