Skip to content

Commit 4e5d851

Browse files
authored
PEP 624: Minor updates (#1666)
Remove Python 3.9 from plan, because it is released already. Rewrite objections section.
1 parent 3619926 commit 4e5d851

File tree

1 file changed

+19
-55
lines changed

1 file changed

+19
-55
lines changed

pep-0624.rst

Lines changed: 19 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -122,23 +122,7 @@ Notes:
122122
Plan
123123
====
124124

125-
Python 3.9
126-
----------
127-
128-
Add ``Py_DEPRECATED(3.3)`` to following APIs. This change is committed
129-
already [3]_. All other APIs have been marked ``Py_DEPRECATED(3.3)``
130-
already.
131-
132-
* ``PyUnicode_EncodeDecimal()``
133-
* ``PyUnicode_TransformDecimalToASCII()``.
134-
135-
Document all APIs as "will be removed in version 3.11".
136-
137-
138-
Python 3.11
139-
-----------
140-
141-
These APIs are removed.
125+
Remove these APIs in Python 3.11. They have been deprecated already.
142126

143127
* ``PyUnicode_Encode()``
144128
* ``PyUnicode_EncodeASCII()``
@@ -259,55 +243,35 @@ If we emit Python warning from ``PyUnicode_EncodeUTF8()``, warning
259243
filters and other threads may change the ``list`` and ``u`` can be
260244
a dangling reference after ``PyUnicode_EncodeUTF8()`` returned.
261245

262-
Additionally, since we are not changing behavior but removing C APIs,
263-
runtime ``DeprecationWarning`` might not helpful for Python
264-
developers. We should warn to extension developers instead.
265-
266-
267-
Deprecate ``PyUnicode_Decode*`` APIs too
268-
----------------------------------------
269246

270-
Not only remove ``PyUnicode_Encode*()`` APIs, but also deprecate
271-
following APIs too for symmetry and reducing number of APIs.
272247

273-
* ``PyUnicode_DecodeASCII()``
274-
* ``PyUnicode_DecodeLatin1()``
275-
* ``PyUnicode_DecodeUTF7()``
276-
* ``PyUnicode_DecodeUTF8()``
277-
* ``PyUnicode_DecodeUTF16()``
278-
* ``PyUnicode_DecodeUTF32()``
279-
* ``PyUnicode_DecodeUnicodeEscape()``
280-
* ``PyUnicode_DecodeRawUnicodeEscape()``
281-
* ``PyUnicode_DecodeCharmap()``
282-
* ``PyUnicode_DecodeMBCS()``
248+
Discussions
249+
===========
283250

284-
This idea is excluded from this PEP because of several reasons:
251+
* `Plan to remove Py_UNICODE APis except PEP 623
252+
<https://mail.python.org/archives/list/python-dev@python.org/thread/S7KW2U6IGXZFBMGS6WSJB26NZIBW4OLE/#S7KW2U6IGXZFBMGS6WSJB26NZIBW4OLE>`_
253+
* `bpo-41123: Remove Py_UNICODE APIs except PEP 623: <https://bugs.python.org/issue41123>`_
285254

286-
* We can not remove them anytime soon because they are part of stable
287-
ABI.
288255

289-
* ``PyUnicode_DecodeASCII()`` and ``PyUnicode_DecodeUTF8()`` are used
290-
very widely. Deprecating them is not worth enough.
256+
Objections
257+
----------
291258

292-
* Decoding from ``const char*`` is independent from Unicode
293-
representation.
259+
* Removing these APIs removes ability to use codec without temporary Unicode.
294260

295-
* ``PyUnicode_Decode*()`` APIs are useful for applications and
296-
extensions using UTF-8 or Python Unicode objects to store Unicode
297-
string. But ``PyUnicode_Encode*()`` APIs are not useful for them.
261+
* Codecs can not encode Unicode buffer directly without temporary Unicode
262+
object since Python 3.3. All these APIs creates temporary Unicode object
263+
for now. So removing them doesn't reduce any abilities.
298264

299-
* Python implementations using UTF-8 for Unicode internal
300-
representation (e.g. PyPy and micropython) may not have encoder
301-
with ``wchar_t*`` or UCS-4 input. But decoding from ``char*``
302-
is very natural for them too.
265+
* Why not remove decoder APIs too?
303266

267+
* They are part of stable ABI.
304268

305-
Discussions
306-
===========
269+
* ``PyUnicode_DecodeASCII()`` and ``PyUnicode_DecodeUTF8()`` are used
270+
very widely. Deprecating them is not worth enough.
307271

308-
* `Plan to remove Py_UNICODE APis except PEP 623
309-
<https://mail.python.org/archives/list/python-dev@python.org/thread/S7KW2U6IGXZFBMGS6WSJB26NZIBW4OLE/#S7KW2U6IGXZFBMGS6WSJB26NZIBW4OLE>`_
310-
* `bpo-41123: Remove Py_UNICODE APIs except PEP 623: <https://bugs.python.org/issue41123>`_
272+
* Decoder APIs can decode from byte buffer directly, without creating
273+
temporary bytes object. On the other hand, encoder APIs can not avoid
274+
temporary Unicode object.
311275

312276

313277
References

0 commit comments

Comments
 (0)