This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Unclear intention of deprecating Py_UNICODE_TOLOWER / Py_UNICODE_TOUPPER
Type: Stage:
Components: Unicode Versions: Python 3.6
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: ezio.melotti, ideasman42, vstinner
Priority: normal Keywords:

Created on 2017-12-18 02:00 by ideasman42, last changed 2022-04-11 14:58 by admin.

Messages (4)
msg308506 - (view) Author: Campbell Barton (ideasman42) * Date: 2017-12-18 02:00
Py_UNICODE_TOLOWER / Py_UNICODE_TOUPPER are marked as deprecated in the docs.

https://docs.python.org/3/c-api/unicode.html?highlight=py_unicode_tolower#c.Py_UNICODE_TOLOWER

Someone submitted a patch to our project which uses these.

What is unclear, is if there is an intention to replace these (wrappers for '_PyUnicode_ToLowerFull' for eg).

Or if this will be removed without any alternative.

I assume the functionality will be kept somewhere since Python needs str.lower/upper.

Will there be a way to perform this in the future? Either way, could docs be updated to reflect this?
msg308523 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-12-18 08:56
Py_UNICODE_TOLOWER / Py_UNICODE_TOUPPER *API* doesn't respect the latest Unicode standard. For example, it doesn't support this operation:

>>> "ß".upper()
'SS'
msg308607 - (view) Author: Campbell Barton (ideasman42) * Date: 2017-12-19 02:11
Thanks for the info, in that case will there be a way to do this from the CPython API which can work with raw strings? (utf8, wchat_t or similar types), that doesn't require the GIL and alloc/free of PyObjects.
msg355480 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-10-27 16:17
See also bpo-38604: Schedule Py_UNICODE API removal.
History
Date User Action Args
2022-04-11 14:58:55adminsetgithub: 76535
2019-10-27 16:17:44vstinnersetmessages: + msg355480
2017-12-19 02:11:01ideasman42setmessages: + msg308607
2017-12-18 08:56:54vstinnersetmessages: + msg308523
2017-12-18 02:00:12ideasman42create