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

[C API] Rename CFrame or hide it to only export names starting with Py #89594

Closed
vstinner opened this issue Oct 11, 2021 · 8 comments
Closed
Labels
3.11 only security fixes topic-C-API

Comments

@vstinner
Copy link
Member

BPO 45431
Nosy @vstinner, @markshannon, @brandtbucher
PRs
  • bpo-45431: Rename CFrame to _PyCFrame in the C API #31584
  • 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 2022-02-28.15:07:04.281>
    created_at = <Date 2021-10-11.09:50:03.542>
    labels = ['expert-C-API', '3.11']
    title = '[C API] Rename CFrame or hide it to only export names starting with Py'
    updated_at = <Date 2022-02-28.15:07:04.281>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2022-02-28.15:07:04.281>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2022-02-28.15:07:04.281>
    closer = 'vstinner'
    components = ['C API']
    creation = <Date 2021-10-11.09:50:03.542>
    creator = 'vstinner'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 45431
    keywords = ['patch']
    message_count = 8.0
    messages = ['403639', '403640', '403642', '403648', '403649', '414000', '414201', '414202']
    nosy_count = 3.0
    nosy_names = ['vstinner', 'Mark.Shannon', 'brandtbucher']
    pr_nums = ['31584']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue45431'
    versions = ['Python 3.11']

    @vstinner
    Copy link
    Member Author

    #include <Python.h> should only define names which start with "Py" (Py, _Py, PY, _PY), but it now defines a structure called "CFrame" in Include/cpython/pystate.h.

    We should either make the whole PyThreadState structure private (move it to the internal C API), or rename CFrame (to PyCFrame?).

    @vstinner vstinner added 3.11 only security fixes topic-C-API labels Oct 11, 2021
    @vstinner
    Copy link
    Member Author

    See also bpo-45316: [C API] Functions not exported with PyAPI_FUNC().

    @vstinner
    Copy link
    Member Author

    See also the old isssue with "READONLY": bpo-2897 "PyMemberDef missing in limited API / Deprecate structmember.h".

    @markshannon
    Copy link
    Member

    Struct names aren't exported as symbols.

    $ nm ./python | grep CFrame
    So, I assume that are worried about name clashes for code that has
    #include "Python.h".

    Isn't the threadstate struct supposed to be opaque?
    If so, then shouldn't it be moved to an internal header?

    I don't want to add a "Py" prefix to the name of the CFrame struct.
    The names of the various frames are confusing enough, without adding a "Py" prefix to something that isn't a Python frame.

    @vstinner
    Copy link
    Member Author

    Mark Shannon:

    Struct names aren't exported as symbols.

    Right.

    So, I assume that are worried about name clashes for code that has
    #include "Python.h".

    Right :-)

    Isn't the threadstate struct supposed to be opaque?

    Technically, it's public. I'm working on making it opaque in bpo-39947.

    @vstinner
    Copy link
    Member Author

    We should either make the whole PyThreadState structure private (move it to the internal C API), or rename CFrame (to PyCFrame?).

    Well, moving PyThreadState to the internal C API is complicate. I prefer to start by renaming CFrame to PyCFrame: see #75765.

    @vstinner
    Copy link
    Member Author

    New changeset 7496f95 by Victor Stinner in branch 'main':
    bpo-45431: Rename CFrame to _PyCFrame in the C API (GH-31584)
    7496f95

    @vstinner
    Copy link
    Member Author

    Ok, CFrame has been renamed.

    We should either make the whole PyThreadState structure private (move it to the internal C API)

    This idea is tracked by bpo-39947.

    @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.11 only security fixes topic-C-API
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants