classification
Title: Remove Py_UNICODE APIs except PEP 623
Type: Stage: patch review
Components: C API Versions: Python 3.10
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: methane, miss-islington
Priority: normal Keywords: patch

Created on 2020-06-26 03:53 by methane, last changed 2020-06-30 08:49 by miss-islington.

Pull Requests
URL Status Linked Edit
PR 21164 merged methane, 2020-06-26 04:32
PR 21181 open methane, 2020-06-27 16:20
PR 21192 merged methane, 2020-06-28 03:06
PR 21204 merged methane, 2020-06-29 02:35
PR 21205 merged methane, 2020-06-29 04:05
PR 21207 merged miss-islington, 2020-06-29 05:27
PR 21209 merged methane, 2020-06-29 06:51
PR 21227 merged methane, 2020-06-30 03:26
PR 21230 merged miss-islington, 2020-06-30 06:24
Messages (13)
msg372407 - (view) Author: Inada Naoki (methane) * (Python committer) Date: 2020-06-26 03:53
# 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?
msg372460 - (view) Author: Inada Naoki (methane) * (Python committer) Date: 2020-06-27 09:22
New changeset 20a79021753ab26a5989e6d3397160e52973870e by Inada Naoki in branch 'master':
bpo-41123: Remove Py_UNICODE_str* functions (GH-21164)
https://github.com/python/cpython/commit/20a79021753ab26a5989e6d3397160e52973870e
msg372468 - (view) Author: Inada Naoki (methane) * (Python committer) Date: 2020-06-27 16:08
> 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?

I chose this because they are deprecated since 3.3, and Py_DEPRECATED is used since 3.6.
msg372489 - (view) Author: Inada Naoki (methane) * (Python committer) Date: 2020-06-28 01:21
APIs have /* Py_DEPRECATED(3.3) */

* PyUnicode_EncodeDecimal
  It is used in PyLong_FromUnicode.  Deprecate in 3.10 and remove in 3.12

* PyUnicode_TransformDecimalToASCII
  While PEP 393 deprecate this too, its document doesn't has ``deprecated``.  Deprecate in 3.10 and remove in 3.12

* _PyUnicode_ToLowercase, _PyUnicode_ToUppercase
  They are not deprecated by PEP 393, but #12736. Deprecate in 3.10 and remove in 3.12.
  On the other hand, _PyUnicode_ToTitlecase has Py_DEPRECATED. It can be removed in 3.10.
msg372537 - (view) Author: Inada Naoki (methane) * (Python committer) Date: 2020-06-29 01:46
I confirmed PyUnicode_GetMax is not used in top4000 packages.
msg372538 - (view) Author: Inada Naoki (methane) * (Python committer) Date: 2020-06-29 01:47
New changeset d9f2a13106254c53550583adca70aeb3979f2993 by Inada Naoki in branch 'master':
bpo-41123: Remove PyUnicode_GetMax() (GH-21192)
https://github.com/python/cpython/commit/d9f2a13106254c53550583adca70aeb3979f2993
msg372539 - (view) Author: Inada Naoki (methane) * (Python committer) Date: 2020-06-29 04:00
New changeset e4f1fe6edb216e04da03ae80b462ca273f00255b by Inada Naoki in branch 'master':
bpo-41123: Remove PyLong_FromUnicode() (GH-21204)
https://github.com/python/cpython/commit/e4f1fe6edb216e04da03ae80b462ca273f00255b
msg372544 - (view) Author: Inada Naoki (methane) * (Python committer) Date: 2020-06-29 05:26
New changeset 02134dae448c7885c9c07adfc6970f878db33372 by Inada Naoki in branch '3.9':
bpo-41123: Doc: PyLong_FromUnicode will be removed in 3.10 (GH-21205)
https://github.com/python/cpython/commit/02134dae448c7885c9c07adfc6970f878db33372
msg372545 - (view) Author: miss-islington (miss-islington) Date: 2020-06-29 05:36
New changeset ea164309dea4e7f92aeda6daa9e9679290c68827 by Miss Islington (bot) in branch '3.8':
bpo-41123: Doc: PyLong_FromUnicode will be removed in 3.10 (GH-21205)
https://github.com/python/cpython/commit/ea164309dea4e7f92aeda6daa9e9679290c68827
msg372548 - (view) Author: Inada Naoki (methane) * (Python committer) Date: 2020-06-29 06:48
PyUnicode_AsUnicodeCopy is not used in top 4000 packages.  Let's remove it too.
msg372646 - (view) Author: Inada Naoki (methane) * (Python committer) Date: 2020-06-30 03:23
New changeset b3332660adb02babb7e66e45310c66dc9a9a94da by Inada Naoki in branch 'master':
bpo-41123: Remove PyUnicode_AsUnicodeCopy (GH-21209)
https://github.com/python/cpython/commit/b3332660adb02babb7e66e45310c66dc9a9a94da
msg372657 - (view) Author: Inada Naoki (methane) * (Python committer) Date: 2020-06-30 06:24
New changeset 2ea6a9928e4fa135888cc8f4733c28d93e642301 by Inada Naoki in branch '3.9':
bpo-41123: Remove PyUnicode_AsUnicodeCopy in 3.10 (GH-21227)
https://github.com/python/cpython/commit/2ea6a9928e4fa135888cc8f4733c28d93e642301
msg372666 - (view) Author: miss-islington (miss-islington) Date: 2020-06-30 08:49
New changeset 41d6e3fbb8bcfd41db37782523caac47e7c8ad23 by Miss Islington (bot) in branch '3.8':
bpo-41123: Remove PyUnicode_AsUnicodeCopy in 3.10 (GH-21227)
https://github.com/python/cpython/commit/41d6e3fbb8bcfd41db37782523caac47e7c8ad23
History
Date User Action Args
2020-06-30 08:49:17miss-islingtonsetmessages: + msg372666
2020-06-30 06:24:26miss-islingtonsetpull_requests: + pull_request20384
2020-06-30 06:24:09methanesetmessages: + msg372657
2020-06-30 03:26:47methanesetpull_requests: + pull_request20380
2020-06-30 03:23:16methanesetmessages: + msg372646
2020-06-29 06:51:17methanesetpull_requests: + pull_request20363
2020-06-29 06:48:41methanesetmessages: + msg372548
2020-06-29 05:36:11miss-islingtonsetmessages: + msg372545
2020-06-29 05:27:04miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request20362
2020-06-29 05:26:34methanesetmessages: + msg372544
2020-06-29 04:05:24methanesetpull_requests: + pull_request20360
2020-06-29 04:00:56methanesetmessages: + msg372539
2020-06-29 02:35:13methanesetpull_requests: + pull_request20359
2020-06-29 01:47:06methanesetmessages: + msg372538
2020-06-29 01:46:27methanesetmessages: + msg372537
2020-06-28 03:06:02methanesetpull_requests: + pull_request20346
2020-06-28 01:21:28methanesetmessages: + msg372489
2020-06-27 16:20:00methanesetpull_requests: + pull_request20337
2020-06-27 16:08:34methanesetmessages: + msg372468
2020-06-27 09:22:11methanesetmessages: + msg372460
2020-06-26 04:32:03methanesetkeywords: + patch
stage: patch review
pull_requests: + pull_request20322
2020-06-26 03:53:21methanecreate