Skip to content

gh-154757: Remove the deprecated Py_UNICODE type - #154759

Open
fedonman wants to merge 1 commit into
python:mainfrom
fedonman:remove-py-unicode-typedef
Open

gh-154757: Remove the deprecated Py_UNICODE type#154759
fedonman wants to merge 1 commit into
python:mainfrom
fedonman:remove-py-unicode-typedef

Conversation

@fedonman

Copy link
Copy Markdown
Contributor

Py_UNICODE is a typedef to wchar_t, deprecated by :pep:393 since 3.3 and at runtime
since 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``), as
GH-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_SetProgramName and PySys_SetArgv were reverted once before in gh-117987.

PY_UNICODE_TYPE, the adjacent typedef, is left alone. It is deprecated but is not listed
for removal in 3.16.

Verified with a full build (make -j), test_capi and test_clinic (1824 tests, SUCCESS).
A file using Py_UNICODE now fails to compile with "unknown type name", while wchar_t
and PY_UNICODE_TYPE still work. Sphinx is not installed here, so the docs build is
unverified locally.

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.
@read-the-docs-community

Copy link
Copy Markdown

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.

1 participant