[issue41123] Remove Py_UNICODE APIs except PEP 623

Inada Naoki report at bugs.python.org
Thu Jun 25 23:53:21 EDT 2020


New submission from Inada Naoki <songofacandy at gmail.com>:

# APIs relating to wstr

Since some APIs did not have Py_DEPRECATE until 3.9 (see GH-20941), it can not be removed in 3.10. I wrote PEP 623 for them.

This issue doesn't about them.


# Deprecated since Python 3.3, and not documented.

In Python 3.3 what's new:

* :c:macro:`Py_UNICODE_strlen`: use :c:func:`PyUnicode_GetLength` or
  :c:macro:`PyUnicode_GET_LENGTH`
* :c:macro:`Py_UNICODE_strcat`: use :c:func:`PyUnicode_CopyCharacters` or
  :c:func:`PyUnicode_FromFormat`
* :c:macro:`Py_UNICODE_strcpy`, :c:macro:`Py_UNICODE_strncpy`,
  :c:macro:`Py_UNICODE_COPY`: use :c:func:`PyUnicode_CopyCharacters` or
  :c:func:`PyUnicode_Substring`
* :c:macro:`Py_UNICODE_strcmp`: use :c:func:`PyUnicode_Compare`
* :c:macro:`Py_UNICODE_strncmp`: use :c:func:`PyUnicode_Tailmatch`
* :c:macro:`Py_UNICODE_strchr`, :c:macro:`Py_UNICODE_strrchr`: use
  :c:func:`PyUnicode_FindChar`

These functions are not documented.  But they has Py_DEPRECATED(3.3) from Python 3.6.
Let's remove them in 3.10.


# Deprecated since Python 3.3 with document

Some APIs has document with `.. deprecated:: 3.3 4.0`.

* PyLong_FromUnicode
* PyUnicode_TransformDecimalToASCII
* PyUnicode_AsUnicodeCopy
* PyUnicode_Encode
* PyUnicode_EncodeUTF7
* PyUnicode_EncodeUTF8
* PyUnicode_EncodeUTF16
* PyUnicode_EncodeUTF32
* PyUnicode_EncodeUnicodeEscape
* PyUnicode_EncodeRawUnicodeEscape
* PyUnicode_EncodeLatin1
* PyUnicode_EncodeASCII
* PyUnicode_EncodeCharmap
* PyUnicode_TranslateCharmap
* PyUnicode_EncodeMBCS


a) Can we replace 4.0 with 3.10 and remove them in 3.10?
b) Or should we replace 4.0 with 3.11 and wait one more year?

----------
components: C API
messages: 372407
nosy: inada.naoki
priority: normal
severity: normal
status: open
title: Remove Py_UNICODE APIs except PEP 623
versions: Python 3.10

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41123>
_______________________________________


More information about the Python-bugs-list mailing list