gh-154757: Remove the deprecated Py_UNICODE type - #154759
Open
fedonman wants to merge 1 commit into
Open
Conversation
Py_UNICODE was a typedef to wchar_t, deprecated by PEP 393 since Python 3.3 and at runtime since Python 3.13, and scheduled for removal in 3.16. Nothing in CPython used it: the Argument Clinic converter of the same name generates const wchar_t *, and the typedef is not part of the stable ABI. The documentation references to it are kept, with the link suppressed, as was done for PyWeakref_GetObject in pythonGH-133657.
fedonman
requested review from
AA-Turner,
StanFromIreland,
ZeroIntensity and
hugovk
as code owners
July 27, 2026 08:24
3 tasks
Documentation build overview
9 files changed ·
|
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.
Py_UNICODEis a typedef towchar_t, deprecated by :pep:393since 3.3 and at runtimesince 3.13, listed for removal in 3.16. This removes it.
Nothing in CPython used the typedef. The Argument Clinic converter of the same name is
unrelated: it generates
const wchar_t *. It is not in the stable ABI.Documentation references are kept with the link suppressed (
:c:type:!Py_UNICODE``), asGH-133657 did for
PyWeakref_GetObject, and the anchor is recorded in`Doc/tools/removed-ids.txt`.
This covers one of the three groups in gh-154757 and one box in gh-133644. The other two
groups are not touched here: GH-136277 and GH-133654 are already open for them, and
Py_SetProgramNameandPySys_SetArgvwere reverted once before in gh-117987.PY_UNICODE_TYPE, the adjacent typedef, is left alone. It is deprecated but is not listedfor removal in 3.16.
Verified with a full build (
make -j),test_capiandtest_clinic(1824 tests, SUCCESS).A file using
Py_UNICODEnow fails to compile with "unknown type name", whilewchar_tand
PY_UNICODE_TYPEstill work. Sphinx is not installed here, so the docs build isunverified locally.