Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove _PyUnicode_AsKind from private C API #84311

Closed
serhiy-storchaka opened this issue Mar 31, 2020 · 2 comments
Closed

Remove _PyUnicode_AsKind from private C API #84311

serhiy-storchaka opened this issue Mar 31, 2020 · 2 comments
Labels
3.9 only security fixes topic-C-API type-feature A feature request or enhancement

Comments

@serhiy-storchaka
Copy link
Member

BPO 40130
Nosy @vstinner, @serhiy-storchaka
PRs
  • bpo-40130: _PyUnicode_AsKind() should not be exported. #19265
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2020-04-01.12:42:11.740>
    created_at = <Date 2020-03-31.21:15:43.464>
    labels = ['expert-C-API', 'type-feature', '3.9']
    title = 'Remove _PyUnicode_AsKind from private C API'
    updated_at = <Date 2020-04-01.12:42:11.739>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2020-04-01.12:42:11.739>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-04-01.12:42:11.740>
    closer = 'serhiy.storchaka'
    components = ['C API']
    creation = <Date 2020-03-31.21:15:43.464>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 40130
    keywords = ['patch']
    message_count = 2.0
    messages = ['365427', '365459']
    nosy_count = 2.0
    nosy_names = ['vstinner', 'serhiy.storchaka']
    pr_nums = ['19265']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue40130'
    versions = ['Python 3.9']

    @serhiy-storchaka
    Copy link
    Member Author

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

    @serhiy-storchaka serhiy-storchaka added 3.9 only security fixes topic-C-API type-feature A feature request or enhancement labels Mar 31, 2020
    @serhiy-storchaka
    Copy link
    Member Author

    New changeset 17b4733 by Serhiy Storchaka in branch 'master':
    bpo-40130: _PyUnicode_AsKind() should not be exported. (GH-19265)
    17b4733

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.9 only security fixes topic-C-API type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant