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.

Title: Remove _PyUnicode_AsKind from private C API
Type: enhancement Stage: resolved
Components: C API Versions: Python 3.9
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: serhiy.storchaka, vstinner
Priority: normal Keywords: patch

Created on 2020-03-31 21:15 by serhiy.storchaka, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 19265 merged serhiy.storchaka, 2020-03-31 21:18
Messages (2)
msg365427 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-03-31 21:15
_PyUnicode_AsKind is exposed as private C API. It is only used in unicodeobject.c, where it is defined. Its name starts with an underscore, it is not documented and not included in PC/python3.def (therefore is not exported on Windows). Seems it is not used in third party code (I have not found any occurrences on GitHub except CPython clones).

Initially it was also used in Python/formatter_unicode.c, and I think it is the only reason of exposing it in the header. I think that now it can be removed.

The proposed PR removes _PyUnicode_AsKind from headers, makes it static, rename it, and change its signature (since all the kind, data pointer and length are available at the caller site). It also includes minor cleanup and microoptimizations.
msg365459 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-04-01 12:41
New changeset 17b4733f2ff0a4abc06e8c745755c06fc32942dd by Serhiy Storchaka in branch 'master':
bpo-40130: _PyUnicode_AsKind() should not be exported. (GH-19265)
Date User Action Args
2022-04-11 14:59:28adminsetgithub: 84311
2020-04-01 12:42:11serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2020-04-01 12:41:58serhiy.storchakasetmessages: + msg365459
2020-03-31 21:18:50serhiy.storchakasetkeywords: + patch
stage: patch review
pull_requests: + pull_request18622
2020-03-31 21:15:43serhiy.storchakacreate