[Python-Dev] Re: Plan to remove Py_UNICODE APis except PEP 623.

2020年6月29日 03:01:03 -0700

Le dim. 28 juin 2020 à 04:39, Inada Naoki <[email protected]> a écrit :
> ## Documented and have Py_DEPRECATED
>
> * PyLong_FromUnicode
> * 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
>
> These APIs are documented. The document has ``.. deprecated:: 3.3
> 4.0`` directive.
> They have been `Py_DEPRECATED` since Python 3.6 too.
>
> Plan: Change the document to ``.. deprecated:: 3.0 3.10`` and remove
> them in Python 3.10.
".. deprecated" markups are nice, but not easy to discover. I would
help to add a "Deprecated" section of C API Changes and list functions
scheduled for removal in the next Python version:
https://docs.python.org/dev/whatsnew/3.9.html#c-api-changes
I understand that these ".. deprecated" markups will be added to 3.8
and 3.9 documentation, right?
For each function, I would be nice to suggest a replacement function.
For example, PyUnicode_EncodeMBCS() (Py_UNICODE*) can be replaced with
PyUnicode_EncodeCodePage() using code_page=CP_ACP (PyObject*).
> ## PyUnicode_EncodeDecimal
>
> It is not documented. It has not been deprecated by Py_DEPRECATED.
> Plan: Add Py_DEPRECATED in Python 3.9 and remove it in 3.11.
I understood that the replacement function is the private
_PyUnicode_TransformDecimalAndSpaceToASCII() function. This function
is used by complex, float and int types to convert a string into a
number.
> ## PyUnicode_TransformDecimalToASCII
>
> It is documented, but doesn't have ``deprecated`` directive. It is not
> deprecated by Py_DEPRECATED.
>
> Plan: Add Py_DEPRECATED and ``deprecated 3.3 3.11`` directive in 3.9,
> and remove it in 3.11.
I don't think that we need to expose such function as part of the
public C API. IMHO it only was exposed to be consumed by Python
itself. So I don't think that we need to provide a replacement
function.
After the function will be removed, if someone complains, we can
design a new replacement function. But I prefer to not *guess* what is
the exact use case.
> ## _PyUnicode_ToLowercase, _PyUnicode_ToUppercase
>
> They are not deprecated by PEP 393, but bpo-12736.
>
> They are documented as deprecated, but don't have ``Py_DEPRECATED``.
>
> Plan: Add Py_DEPRECATED in 3.9, and remove them in 3.11.
>
> Note: _PyUnicode_ToTitlecase has Py_DEPRECATED. It can be removed in 3.10.
bpo-12736 is "Request for python casemapping functions to use full not
simple casemaps per Unicode's recommendation". IMHO the replacement
function is to call lower() and method() of a Python str object.
If you change the 3.9 documentation, please also update 3.8 doc.
Victor
-- 
Night gathers, and now my watch begins. It shall not end until my death.
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/TDP27YPEZH7CWKQ52ZEPW5YIIDXSLS55/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to