Skip to content

gh-154757: Unschedule removal of Py_UNICODE (and Py_UNICODE_TYPE) - #160538

Open
encukou wants to merge 1 commit into
python:mainfrom
encukou:undeprecate-Py_UNICODE
Open

encukou wants to merge 1 commit into
python:mainfrom
encukou:undeprecate-Py_UNICODE

Conversation

@encukou

@encukou encukou commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

PEP-387 says (and did say back when these types were deprecated in 3.13):

If the expected maintenance overhead and security risk of the
deprecated behavior is small (e.g. an old function is
reimplemented in terms of a new, more general one),
it can stay indefinitely (or until the situation changes).

There's no need to remove two one-line typedefs.

PEP-387 says (and did say back when these types were deprecated in 3.13):

> If the expected maintenance overhead and security risk of the
> deprecated behavior is small (e.g. an old function is
> reimplemented in terms of a new, more general one),
> it can stay indefinitely (or until the situation changes).

There's no need to remove these.
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #35367863 | 📁 Comparing 0e59aed against main (5ca490b)

  🔍 Preview build  

6 files changed · ± 6 modified

± Modified

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Py_UNICODE and Py_UNICODE_TYPE are legacy of Python 3.2 which had this annoying "narrow vs wide" build. Python 3.3 and newer now uses Py_UCS4 which is 32-bit on all platforms. I don't think that we should keep them longer. It doesn't seem to be a big deal to remove these types: #154759 (comment).

If you want wchar_t, well, use wchar_t. Don't use Py_UNICODE or Py_UNICODE_TYPE.

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

Labels

awaiting core review docs Documentation in the Doc dir skip news type-feature A feature request or enhancement

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants