Skip to content

C API: Remove legacy API functions to configure Python initialization #105145

Description

@vstinner

The following C API functions were deprecated in Python 3.11 by issue #88279:

  • PySys_AddWarnOptionUnicode()
  • PySys_AddWarnOption()
  • PySys_AddXOption()
  • PySys_HasWarnOptions()
  • PySys_SetArgvEx()
  • PySys_SetArgv()
  • PySys_SetPath()
  • Py_SetPath()
  • Py_SetProgramName()
  • Py_SetPythonHome()
  • Py_SetStandardStreamEncoding()
  • _Py_SetProgramFullPath()

IMO it's now time to remove them: the new PyConfig API is available since Python 3.8: https://docs.python.org/dev/c-api/init_config.html

Linked PRs

Activity

  1. added 3 commits that reference this issue on May 31, 2023
  2. vstinner commented on May 31, 2023

    @vstinner
    MemberAuthor

    Oh no, too bad, I forgot to deprecate PySys_ResetWarnOptions() in Python 3.11.

  3. vstinner commented on May 31, 2023

    @vstinner
    MemberAuthor

    Functions like Py_GetPath() function also be deprecated.

  4. added 6 commits that reference this issue on May 31, 2023
  5. added a commit that references this issue on Jun 1, 2023
  6. encukou commented on Jan 16, 2024

    @encukou
    Member

    The original issue says:

    I don't propose to schedule the removal of these functions, only mark them as deprecated in the documentation.

    What changed?

  7. vstinner commented on Jan 16, 2024

    @vstinner
    MemberAuthor

    What changed?

    Issue gh-88279 was in 2021.

    I wrote it in this issue description in 2023:

    IMO it's now time to remove them: the new PyConfig API is available since Python 3.8: https://docs.python.org/dev/c-api/init_config.html

    What changed in that the PyConfig API is now widely available and is a better API than the deprecated one.

  8. encukou commented on Feb 1, 2024

    @encukou
    Member

    What changed in that the PyConfig API is now widely available and is a better API than the deprecated one.

    It seems a PEP is needed for a full replacement. You wrote PEP-741, there are objections against the basic concept of PEP-741 :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions