Repository navigation
fix: keep deprecated altchars handling when decoding with padded=False - #1075
Merged
Merged
Conversation
With validate=True and padded=False, the C extension used the strict alphabet translation, so '+' or '/' with custom altchars raised binascii.Error instead of the DeprecationWarning that the fallback and the standard library give when ignorechars is not specified.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1075 +/- ##
=======================================
Coverage 99.58% 99.58%
=======================================
Files 11 11
Lines 1937 1950 +13
Branches 306 307 +1
=======================================
+ Hits 1929 1942 +13
Partials 8 8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Owner
|
Thanks for the PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With
validate=Trueandpadded=False, the C extension rejects+or/in the input when customaltcharsare given, while the pure Python fallback (and the Python 3.15base64.b64decodeit mirrors) still decode the data and emit theDeprecationWarning, becauseignorecharswas not specified:padded=Falsesets the internal ignorechars default, and that branch switched to the stricttranslatefunction. This change only switches to strict translation when the caller passedignorechars, so an explicitignorecharskeeps raising as before (test_altchars_translationis unchanged).Tests: added
test_warning_data_dec_unpadded, thepadded=Falsevariant oftest_warning_data_dec, including the 16 KiB slice case. Locally (Linux x86_64, Python 3.12, C extension built with all SIMD paths available up to AVX512VBMI):validate=Trueones); the fulltestsdirectory gives 14 failed, 22088 passed, 58 skippedI did not run the sanitizer build, other platforms or Python 3.15. I left the changelog in the README alone in case you prefer to write that entry.