Skip to content

Conversation

@serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Jan 19, 2026

@serhiy-storchaka
Copy link
Member Author

This is a draft because I am going to apply the error handling changes in a separate issue first.

We can also apply some optimizations -- cache the ignored chars and returning on fast path after ignored characters.

@serhiy-storchaka serhiy-storchaka force-pushed the base64-decode-ignorechars branch from 1b0bb87 to 192d535 Compare January 19, 2026 11:19
@serhiy-storchaka serhiy-storchaka marked this pull request as ready for review January 19, 2026 11:20
@serhiy-storchaka
Copy link
Member Author

Well, the issue with error handling was just that the error message could be more specific in some cases. It is not a bug. It can be included in this PR.

@serhiy-storchaka serhiy-storchaka force-pushed the base64-decode-ignorechars branch from 192d535 to 4f3847e Compare January 19, 2026 11:23
When set to true, bytes that are not part of the base64 standard are
not allowed. The same applies to excess data after padding (= / ==).
Set to True by default if ignorechars is specified, False otherwise.
ignorechars: PyBytesObject = NULL
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we support other types besides bytes? See also #144027.

@moneebullah25
Copy link
Contributor

No worries, that was the point I was just free on Sunday, so I push out a PR in case you haven't started on it. BTW your PR looks good, I am no maintainer but you just have to run ./python Tools/build/generate_global_objects.py to generate the updated header files. I hope it helps.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants