GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-145980: Add support for alternative alphabets in the binascii module by serhiy-storchaka · Pull Request #145981 · python/cpython

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Mar 15, 2026 •
edited by github-actions Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member
  • Add the alphabet parameter in functions b2a_base64(), a2b_base64(), b2a_base85() and a2b_base85().
  • And a number of "*_ALPHABET" constants.
  • Remove b2a_z85() and a2b_z85().
  • Issue: Support alternative alphabets in BaseXX encodings #145980

📚 Documentation preview 📚: https://cpython-previews--145981.org.readthedocs.build/

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@serhiy-storchaka
pythongh-145980: Add support for alternative alphabets in the binasci…
f47f4bd
…i module

* Add the alphabet parameter in functions b2a_base64(), a2b_base64(),
  b2a_base85() and a2b_base85().
* And a number of "*_ALPHABET" constants.
* Remove b2a_z85() and a2b_z85().
@serhiy-storchaka
serhiy-storchaka requested a review from AA-Turner as a code owner March 15, 2026 14:43
@bedevere-app bedevere-app Bot mentioned this pull request Mar 15, 2026
Support alternative alphabets in BaseXX encodings #145980
Closed
@bedevere-app bedevere-app Bot added the awaiting core review label Mar 15, 2026
@serhiy-storchaka serhiy-storchaka mentioned this pull request Mar 15, 2026
gh-145968: fix base64.b64decode altchars translation in specific cases #145969
Merged
picnixz
picnixz reviewed Mar 15, 2026
View reviewed changes
Comment thread Doc/library/binascii.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Doc/library/binascii.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Doc/library/binascii.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Lib/base64.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Lib/test/test_binascii.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Lib/test/test_binascii.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Lib/test/test_binascii.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Modules/binascii.c
static PyObject *
get_reverse_table(binascii_state *state, PyObject *alphabet, int size, int padchar)
{
PyObject *reverse_table;

@picnixz picnixz Mar 15, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I'd suggest having a goto error for cleanup in case this function grows.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@serhiy-storchaka serhiy-storchaka Mar 16, 2026

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I think this is preliminary.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
serhiy-storchaka added 10 commits March 15, 2026 20:38
@serhiy-storchaka
Update documentation.
ce5bcd2
@serhiy-storchaka
Update tests.
f59fffe
@serhiy-storchaka
Refactoring: inline static functions for Base85.
33437a5
@serhiy-storchaka
Merge branch 'main' into binascii-alphabet
044fa5a
@serhiy-storchaka
Regen global strings.
3caf10d
@serhiy-storchaka
Fix Sphinx warnings.
c27319a
@serhiy-storchaka
Merge branch 'main' into binascii-alphabet
1abf3dd
@serhiy-storchaka
Remove old tests.
4444158
@serhiy-storchaka
Remove less common alphabets.
133505d
@serhiy-storchaka
Merge branch 'main' into binascii-alphabet
f0f5960
@serhiy-storchaka

serhiy-storchaka commented Mar 17, 2026

Copy link
Copy Markdown
Member Author

Damn, what is now? I spent more time fighting the CI than fixing genuine bugs.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@serhiy-storchaka
Merge branch 'main' into binascii-alphabet
c609bbb
This was referenced Mar 19, 2026
gh-101178: Add Ascii85, Base85, and Z85 support to binascii #102753
Merged
gh-146192: Add base32 support to binascii #146193
Merged
@serhiy-storchaka

serhiy-storchaka commented Mar 20, 2026

Copy link
Copy Markdown
Member Author

Are there other suggestions or notes? I am going to merge this PR, because it is a dependence for #146192 and other changes.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@picnixz

picnixz commented Mar 20, 2026

Copy link
Copy Markdown
Member

Not from side!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@serhiy-storchaka
serhiy-storchaka merged commit 4507d49 into python:main Mar 20, 2026
50 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@serhiy-storchaka
serhiy-storchaka deleted the binascii-alphabet branch March 20, 2026 11:07
@bedevere-app bedevere-app Bot removed the awaiting core review label Mar 20, 2026
@serhiy-storchaka

serhiy-storchaka commented Mar 20, 2026

Copy link
Copy Markdown
Member Author

Thank you for your review @picnixz.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot

bedevere-bot commented Mar 20, 2026

Copy link
Copy Markdown

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot ARM64 MacOS M1 Refleaks NoGIL 3.x (tier-2) has failed when building commit 4507d49.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/1368/builds/4852) and take a look at the build logs.
  4. Check if the failure is related to this commit (4507d49) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/1368/builds/4852

Failed tests:

  • test_capi
  • test.test_concurrent_futures.test_interpreter_pool
  • test_import

Test leaking resources:

  • test_interpreter_pool: references
  • test_capi: references
  • test_interpreter_pool: memory blocks
  • test_import: references
  • test_capi: memory blocks
  • test_import: memory blocks

Summary of the results of the build (if available):

==

Click to see traceback logs
TracebackTests.test_nonexistent_module_nested) ... ok


TracebackTests.test_broken_parent) ... ok


TracebackTests.test_unencodable_filename) ... skipped 'need TESTFN_UNENCODABLE'


TracebackTests.test_exec_failure_nested) ... ok


Traceback (most recent call last):
  File "<string>", line 10, in <module>
  File "<frozen importlib._bootstrap>", line 786, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 1025, in create_module
  File "<frozen importlib._bootstrap>", line 491, in _call_with_frames_removed
ImportError: module _test_module_state_shared does not support loading in subinterpreters
xpected failure


TracebackTests.test_import_bug) ... ok


TracebackTests.test_syntax_error) ... ok


TracebackTests.test_nonexistent_module) ... ok


TracebackTests.test_broken_from) ... ok


TracebackTests.test_broken_submodule) ... ok


TracebackTests.test_exec_failure) ... ok


TracebackTests.test_broken_parent_from) ... ok
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot

bedevere-bot commented Mar 20, 2026

Copy link
Copy Markdown

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot s390x Fedora Stable Refleaks 3.x (tier-3) has failed when building commit 4507d49.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/1641/builds/1849) and take a look at the build logs.
  4. Check if the failure is related to this commit (4507d49) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/1641/builds/1849

Failed tests:

  • test_capi
  • test.test_concurrent_futures.test_interpreter_pool
  • test_import

Test leaking resources:

  • test_interpreter_pool: references
  • test_capi: references
  • test_interpreter_pool: memory blocks
  • test_import: references
  • test_capi: memory blocks
  • test_import: memory blocks

Summary of the results of the build (if available):

==

Click to see traceback logs
TracebackTests.test_nonexistent_module_nested) ... ok


TracebackTests.test_broken_parent) ... ok


TracebackTests.test_exec_failure_nested) ... ok


TracebackTests.test_import_bug) ... ok


TracebackTests.test_syntax_error) ... ok


TracebackTests.test_nonexistent_module) ... ok


TracebackTests.test_unencodable_filename) ... ok


TracebackTests.test_broken_from) ... ok


TracebackTests.test_broken_submodule) ... ok


TracebackTests.test_exec_failure) ... ok


TracebackTests.test_broken_parent_from) ... ok
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot

bedevere-bot commented Mar 20, 2026

Copy link
Copy Markdown

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot PPC64LE Fedora Stable Refleaks 3.x (tier-2) has failed when building commit 4507d49.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/280/builds/2905) and take a look at the build logs.
  4. Check if the failure is related to this commit (4507d49) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/280/builds/2905

Failed tests:

  • test_capi
  • test.test_concurrent_futures.test_interpreter_pool
  • test_import

Test leaking resources:

  • test_interpreter_pool: references
  • test_capi: references
  • test_interpreter_pool: memory blocks
  • test_import: references
  • test_capi: memory blocks
  • test_import: memory blocks

Summary of the results of the build (if available):

==

Click to see traceback logs
TracebackTests.test_nonexistent_module_nested) ... ok


TracebackTests.test_broken_parent) ... ok


TracebackTests.test_exec_failure_nested) ... ok


TracebackTests.test_import_bug) ... ok


TracebackTests.test_syntax_error) ... ok


TracebackTests.test_nonexistent_module) ... ok


TracebackTests.test_unencodable_filename) ... ok


TracebackTests.test_broken_from) ... ok


TracebackTests.test_broken_submodule) ... ok


TracebackTests.test_exec_failure) ... ok


TracebackTests.test_broken_parent_from) ... ok
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

ashm-dev pushed a commit to ashm-dev/cpython that referenced this pull request Mar 20, 2026
@serhiy-storchaka @ashm-dev
pythongh-145980: Add support for alternative alphabets in the binasci…
f79d421
…i module (pythonGH-145981)

* Add the alphabet parameter in functions b2a_base64(), a2b_base64(),
  b2a_base85(), and a2b_base85().
* And a number of "*_ALPHABET" constants.
* Remove b2a_z85() and a2b_z85().
kangtastic added a commit to kangtastic/cpython that referenced this pull request Mar 20, 2026
@kangtastic
Update PR for python#145981
bf1308f
- Use the new `alphabet` parameter in `binascii`
- Remove `binascii.a2b_base32hex()` and `binascii.b2a_base32hex()`
- Change value for `.. versionadded::` ReST directive in docs for
  new `binascii` functions to "next" instead of "3.15"
@vstinner

vstinner commented Mar 20, 2026

Copy link
Copy Markdown
Member

This change introduced reference leaks in 3 tests:

  • test_capi: test.test_capi.test_misc.SubinterpreterTest.test_mutate_exception test
  • test_concurrent_futures.test_interpreter_pool
  • test_import

I wrote #146230 to fix the leak.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

CuriousLearner added a commit to CuriousLearner/cpython that referenced this pull request Mar 22, 2026
@CuriousLearner
Merge remote-tracking branch 'upstream/main' into fix-pythongh-138577
2691ad9
* upstream/main: (1475 commits)
  Docs: replace all `datetime` imports with `import datetime as dt` (python#145640)
  pythongh-146153: Use `frozendict` in pure python fallback for `curses.has_key` (python#146154)
  pythongh-138234: clarify returncode behavior for subprocesses created with `shell=True` (python#138536)
  pythongh-140947: fix contextvars handling for server tasks in asyncio  (python#141158)
  pythonGH-100108: Add async generators best practices section (python#141885)
  pythonGH-145667: Merge `GET_ITER` and `GET_YIELD_FROM_ITER` (pythonGH-146120)
  pythongh-146228: Better fork support in cached FastPath (python#146231)
  pythongh-146227: Fix wrong type in _Py_atomic_load_uint16 in pyatomic_std.h (pythongh-146229)
  pythongh-145980: Fix copy/paste mistake in binascii.c (python#146230)
  pythongh-146092: Raise MemoryError on allocation failure in _zoneinfo (python#146165)
  pythongh-91279: Note `SOURCE_DATE_EPOCH` support in `ZipFile.writestr()` doc (python#139396)
  pythongh-146196: Fix Undefined Behavior in _PyUnicodeWriter_WriteASCIIString() (python#146201)
  pythongh-143930: Reject leading dashes in webbrowser URLs
  pythongh-145916: Soft-deprecate ctypes.util.find_library (pythonGH-145919)
  pythongh-146205: Check the errno with != 0 in close impls in select module (python#146206)
  pythongh-146171: Fix nested AttributeError suggestions (python#146188)
  pythongh-146099: Optimize _GUARD_CODE_VERSION+IP via function version symbols (pythonGH-146101)
  pythongh-145980: Add support for alternative alphabets in the binascii module (pythonGH-145981)
  pythongh-145754: Update signature retrieval in unittest.mock to use forwardref annotation format (python#145756)
  pythongh-145177: Add emscripten run --test, uses test args from config.toml (python#146160)
  ...
@pablogsal pablogsal mentioned this pull request Apr 4, 2026
gh-130273: Fix traceback color output with unicode characters #142529
Merged
ljfp pushed a commit to ljfp/cpython that referenced this pull request Apr 25, 2026
@serhiy-storchaka @ljfp
pythongh-145980: Add support for alternative alphabets in the binasci…
357b3eb
…i module (pythonGH-145981)

* Add the alphabet parameter in functions b2a_base64(), a2b_base64(),
  b2a_base85(), and a2b_base85().
* And a number of "*_ALPHABET" constants.
* Remove b2a_z85() and a2b_z85().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@picnixz picnixz picnixz left review comments
@AA-Turner AA-Turner Awaiting requested review from AA-Turner AA-Turner is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@serhiy-storchaka @picnixz @bedevere-bot @vstinner
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.