bpo-36346: array: Don't use deprecated APIs (GH-19653)
* Py_UNICODE -> wchar_t
* Py_UNICODE -> unicode in Argument Clinic
* PyUnicode_AsUnicode -> PyUnicode_AsWideCharString
* Don't use "u#" format.
Co-authored-by: Victor Stinner <vstinner@python.org>
diff --git a/Doc/library/array.rst b/Doc/library/array.rst
index c9a9b1d..7802073 100644
--- a/Doc/library/array.rst
+++ b/Doc/library/array.rst
@@ -22,7 +22,7 @@
+-----------+--------------------+-------------------+-----------------------+-------+
| ``'B'`` | unsigned char | int | 1 | |
+-----------+--------------------+-------------------+-----------------------+-------+
-| ``'u'`` | Py_UNICODE | Unicode character | 2 | \(1) |
+| ``'u'`` | wchar_t | Unicode character | 2 | \(1) |
+-----------+--------------------+-------------------+-----------------------+-------+
| ``'h'`` | signed short | int | 2 | |
+-----------+--------------------+-------------------+-----------------------+-------+
@@ -48,15 +48,16 @@
Notes:
(1)
- The ``'u'`` type code corresponds to Python's obsolete unicode character
- (:c:type:`Py_UNICODE` which is :c:type:`wchar_t`). Depending on the
- platform, it can be 16 bits or 32 bits.
+ It can be 16 bits or 32 bits depending on the platform.
- ``'u'`` will be removed together with the rest of the :c:type:`Py_UNICODE`
- API.
+ .. versionchanged:: 3.9
+ ``array('u')`` now uses ``wchar_t`` as C type instead of deprecated
+ ``Py_UNICODE``. This change doesn't affect to its behavior because
+ ``Py_UNICODE`` is alias of ``wchar_t`` since Python 3.3.
.. deprecated-removed:: 3.3 4.0
+
The actual representation of values is determined by the machine architecture
(strictly speaking, by the C implementation). The actual size can be accessed
through the :attr:`itemsize` attribute.
diff --git a/Doc/whatsnew/3.9.rst b/Doc/whatsnew/3.9.rst
index 11e577b..c57d702 100644
--- a/Doc/whatsnew/3.9.rst
+++ b/Doc/whatsnew/3.9.rst
@@ -786,6 +786,12 @@
``PyCF_ALLOW_TOP_LEVEL_AWAIT`` was clashing with ``CO_FUTURE_DIVISION``.
(Contributed by Batuhan Taskaya in :issue:`39562`)
+* ``array('u')`` now uses ``wchar_t`` as C type instead of ``Py_UNICODE``.
+ This change doesn't affect to its behavior because ``Py_UNICODE`` is alias
+ of ``wchar_t`` since Python 3.3.
+ (Contributed by Inada Naoki in :issue:`34538`.)
+
+
CPython bytecode changes
------------------------