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 _PySys_GetObjectId / _PySys_GetObjectId #91143

Closed
corona10 opened this issue Mar 11, 2022 · 9 comments
Closed

Remove _PySys_GetObjectId / _PySys_GetObjectId #91143

corona10 opened this issue Mar 11, 2022 · 9 comments
Assignees
Labels
3.11 only security fixes topic-C-API type-feature A feature request or enhancement

Comments

@corona10
Copy link
Member

BPO 46987
Nosy @pitrou, @vstinner, @ericsnowcurrently, @corona10, @arhadthedev
PRs
  • bpo-46987: Remove _PySys_GetObjectId / _PySys_GetObjectId #31835
  • 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 = 'https://github.com/corona10'
    closed_at = <Date 2022-03-14.12:48:17.491>
    created_at = <Date 2022-03-11.14:08:22.317>
    labels = ['expert-C-API', 'type-feature', '3.11']
    title = 'Remove _PySys_GetObjectId / _PySys_GetObjectId'
    updated_at = <Date 2022-03-14.12:48:17.490>
    user = 'https://github.com/corona10'

    bugs.python.org fields:

    activity = <Date 2022-03-14.12:48:17.490>
    actor = 'corona10'
    assignee = 'corona10'
    closed = True
    closed_date = <Date 2022-03-14.12:48:17.491>
    closer = 'corona10'
    components = ['C API']
    creation = <Date 2022-03-11.14:08:22.317>
    creator = 'corona10'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 46987
    keywords = ['patch']
    message_count = 9.0
    messages = ['414907', '414913', '414914', '414915', '414917', '414918', '414920', '414989', '415133']
    nosy_count = 5.0
    nosy_names = ['pitrou', 'vstinner', 'eric.snow', 'corona10', 'arhadthedev']
    pr_nums = ['31835']
    priority = 'normal'
    resolution = None
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue46987'
    versions = ['Python 3.11']

    @corona10
    Copy link
    Member Author

    There is no usage of _PySys_GetObjectId / _PySys_GetObjectId private APIs in CPython project.
    Since these APIs use _Py_Identifier as the parameter, it looks good to be removed this time when there is no usage at all.
    But before removing these APIs, I will investigate the current usage of external projects even if they are not intended to be used from outside.

    @corona10 corona10 added the 3.11 only security fixes label Mar 11, 2022
    @corona10 corona10 self-assigned this Mar 11, 2022
    @corona10 corona10 added topic-C-API type-feature A feature request or enhancement 3.11 only security fixes labels Mar 11, 2022
    @corona10 corona10 self-assigned this Mar 11, 2022
    @corona10 corona10 added topic-C-API type-feature A feature request or enhancement labels Mar 11, 2022
    @corona10
    Copy link
    Member Author

    ./top_5000/datatable-1.0.0.tar.gz: datatable-1.0.0/src/core/python/obj.cc: _PySys_GetObjectId(&PyId_stdin) // borrowed ref
    ./top_5000/datatable-1.0.0.tar.gz: datatable-1.0.0/src/core/python/obj.cc: _PySys_GetObjectId(&PyId_stdout) // borrowed ref
    ./top_5000/datatable-1.0.0.tar.gz: datatable-1.0.0/src/core/python/obj.cc: _PySys_GetObjectId(&PyId_stderr) // borrowed ref
    ./top_5000/pickle5-0.0.12.tar.gz: pickle5-0.0.12/pickle5/_pickle.c: modules = _PySys_GetObjectId(&PyId_modules);

    @corona10
    Copy link
    Member Author

    @pitrou

    https://github.com/pitrou/pickle5-backport/blob/e6117502435aba2901585cc6c692fb9582545f08/pickle5/_pickle.c#L1937

    Do you have a plan to use PySys_GetObject("modules") instead of _PySys_GetObjectId(&PyId_modules)?

    @corona10
    Copy link
    Member Author

    @vstinner
    From my view, PySys_GetObject is available since Python3.2 both APIs look safe to remove.

    @vstinner
    Copy link
    Member

    https://pypi.org/project/pickle5/ should not be used on Python 3.8 and newer: it's a backport for Python 3.7 and older.

    @vstinner
    Copy link
    Member

    From my view, PySys_GetObject is available since Python3.2 both APIs look safe to remove.

    _PySys_GetObjectId() and _PySys_GetObjectId() are private API and can be removed anytime. We don't provide any backward compatibility warranty on the private API:
    https://docs.python.org/dev/c-api/stable.html#c-api-stability

    "Names prefixed by an underscore, such as _Py_InternalState, are private API that can change without notice even in patch releases."

    @vstinner
    Copy link
    Member

    ./top_5000/datatable-1.0.0.tar.gz: datatable-1.0.0/src/core/python/obj.cc: _PySys_GetObjectId(&PyId_stdout) // borrowed ref

    It would be nice to notify datatable, or even propose a PR, if the _PySys_GetObjectId() is removed in Python 3.11.

    @arhadthedev
    Copy link
    Member

    ./top_5000/datatable-1.0.0.tar.gz: datatable-1.0.0/src/core/python/obj.cc: _PySys_GetObjectId(&PyId_stdin) // borrowed ref

    All three occurences look like this 1 for two years (see git blame):

        #ifndef Py_LIMITED_API
          _PySys_GetObjectId(&PyId_stdin)  // borrowed ref
        #else
          PySys_GetObject("stdin")         // borrowed ref
        #endif

    So everything is fixed already.

    @corona10
    Copy link
    Member Author

    New changeset bb1c543 by Dong-hee Na in branch 'main':
    bpo-46987: Remove _PySys_GetObjectId / _PySys_GetObjectId (GH-31835)
    bb1c543

    @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 type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants