Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 1 addition & 15 deletions Doc/c-api/unicode.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ points must be below 1114112 (which is the full Unicode range).
UTF-8 representation is created on demand and cached in the Unicode object.

.. note::
The :c:type:`Py_UNICODE` representation has been removed since Python 3.12
The :c:type:`!Py_UNICODE` representation has been removed since Python 3.12
with deprecated APIs.
See :pep:`623` for more information.

Expand Down Expand Up @@ -1943,20 +1943,6 @@ Deprecated API

The following API is deprecated.

.. c:type:: Py_UNICODE

This is a typedef of :c:type:`wchar_t`, which is a 16-bit type or 32-bit type
depending on the platform.
Please use :c:type:`wchar_t` directly instead.

.. versionchanged:: 3.3
In previous versions, this was a 16-bit type or a 32-bit type depending on
whether you selected a "narrow" or "wide" Unicode version of Python at
build time.

.. deprecated-removed:: 3.13 3.16


.. c:function:: int PyUnicode_READY(PyObject *unicode)

Do nothing and return ``0``.
Expand Down
2 changes: 0 additions & 2 deletions Doc/deprecations/c-api-pending-removal-in-3.16.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,3 @@ Pending removal in Python 3.16
The :c:func:`Py_InitializeFromConfig` API should be used with
:c:type:`PyConfig` to set these options. Or :c:func:`PyConfig_Get` can be
used to get these options at runtime.

* :c:type:`Py_UNICODE` which was deprecated by :pep:`393`.
1 change: 1 addition & 0 deletions Doc/tools/removed-ids.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ deprecations/index.html: c-api-pending-removal-in-python-3-16
using/configure.html: cmdoption-with-system-libmpdec

# Removed APIs
c-api/unicode.html: c.Py_UNICODE
library/symtable.html: symtable.Class.get_methods
library/sys.html: sys._enablelegacywindowsfsencoding
c-api/import.html: c.PyImport_LazyImportsMode.PyImport_LAZY_NONE
Expand Down
2 changes: 1 addition & 1 deletion Doc/whatsnew/3.11.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2689,7 +2689,7 @@ Removed

.. _whatsnew311-pep624:

* Remove the :c:type:`Py_UNICODE` encoder APIs,
* Remove the :c:type:`!Py_UNICODE` encoder APIs,
as they have been deprecated since Python 3.3,
are little used
and are inefficient relative to the recommended alternatives.
Expand Down
5 changes: 5 additions & 0 deletions Doc/whatsnew/3.16.rst
Original file line number Diff line number Diff line change
Expand Up @@ -841,3 +841,8 @@ Deprecated C APIs

Removed C APIs
--------------

* Remove the deprecated :c:type:`!Py_UNICODE` type, a typedef to
:c:type:`wchar_t` deprecated by :pep:`393` since Python 3.3 and at runtime
since Python 3.13. Use :c:type:`wchar_t` instead.
(Contributed by Vyron Vasileiadis in :gh:`154757`.)
10 changes: 5 additions & 5 deletions Doc/whatsnew/3.3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2265,11 +2265,11 @@ Deprecated Python modules, functions and methods
Deprecated functions and types of the C API
-------------------------------------------

The :c:type:`Py_UNICODE` has been deprecated by :pep:`393` and will be
The :c:type:`!Py_UNICODE` has been deprecated by :pep:`393` and will be
removed in Python 4. All functions using this type are deprecated:

Unicode functions and methods using :c:type:`Py_UNICODE` and
:c:expr:`Py_UNICODE*` types:
Unicode functions and methods using :c:type:`!Py_UNICODE` and
``Py_UNICODE*`` types:

* :c:macro:`!PyUnicode_FromUnicode`: use :c:func:`PyUnicode_FromWideChar` or
:c:func:`PyUnicode_FromKindAndData`
Expand Down Expand Up @@ -2329,7 +2329,7 @@ Deprecated features
-------------------

The :mod:`array` module's ``'u'`` format code is now deprecated and will be
removed in Python 4 together with the rest of the (:c:type:`Py_UNICODE`) API.
removed in Python 4 together with the rest of the (:c:type:`!Py_UNICODE`) API.


Porting to Python 3.3
Expand Down Expand Up @@ -2470,7 +2470,7 @@ Porting C code
All extensions relying on the relevant parts in ``memoryobject.h``
or ``object.h`` must be rebuilt.

* Due to :ref:`PEP 393 <pep-393>`, the :c:type:`Py_UNICODE` type and all
* Due to :ref:`PEP 393 <pep-393>`, the :c:type:`!Py_UNICODE` type and all
functions using this type are deprecated (but will stay available for
at least five years). If you were using low-level Unicode APIs to
construct and access unicode objects and you want to benefit of the
Expand Down
6 changes: 2 additions & 4 deletions Include/cpython/unicodeobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@
# error "this header file must not be included directly"
#endif

/* Py_UNICODE was the native Unicode storage format (code unit) used by
/* PY_UNICODE_TYPE was the native Unicode storage format (code unit) used by
Python and represents a single Unicode element in the Unicode type.
With PEP 393, Py_UNICODE is deprecated and replaced with a
typedef to wchar_t. */
With PEP 393, it is deprecated and replaced with a typedef to wchar_t. */
Py_DEPRECATED(3.13) typedef wchar_t PY_UNICODE_TYPE;
Py_DEPRECATED(3.13) typedef wchar_t Py_UNICODE;


/* --- Internal Unicode Operations ---------------------------------------- */
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Remove the deprecated :c:type:`!Py_UNICODE` type. It was a typedef to
:c:type:`wchar_t`, deprecated by :pep:`393` since Python 3.3 and at runtime
since Python 3.13. Use :c:type:`wchar_t` instead.
Loading