Skip to content

Remove _PySys_GetObjectId / _PySys_GetObjectId #91143

Closed

Description

@corona10
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']

    Activity

    1. corona10 commented on Mar 11, 2022

      @corona10
      MemberAuthor

      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.

    2. self-assigned this
      on Mar 11, 2022
    3. self-assigned this
      on Mar 11, 2022
    4. corona10 commented on Mar 11, 2022

      @corona10
      MemberAuthor

      ./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);

    5. corona10 commented on Mar 11, 2022

      @corona10
      MemberAuthor

      @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)?

    6. corona10 commented on Mar 11, 2022

      @corona10
      MemberAuthor

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

    7. vstinner commented on Mar 11, 2022

      @vstinner
      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.

    8. vstinner commented on Mar 11, 2022

      @vstinner
      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."

    9. vstinner commented on Mar 11, 2022

      @vstinner
      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.

    10. arhadthedev commented on Mar 12, 2022

      @arhadthedev
      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.

    11. corona10 commented on Mar 14, 2022

      @corona10
      MemberAuthor

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

    12. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions