[New-bugs-announce] [issue40130] Remove _PyUnicode_AsKind from private C API

Serhiy Storchaka report at bugs.python.org
Tue Mar 31 17:15:43 EDT 2020


New submission from Serhiy Storchaka <storchaka+cpython at gmail.com>:

_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.

----------
components: C API
messages: 365427
nosy: serhiy.storchaka, vstinner
priority: normal
severity: normal
status: open
title: Remove _PyUnicode_AsKind from private C API
type: enhancement
versions: Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40130>
_______________________________________


More information about the New-bugs-announce mailing list