Skip to content

C API: Clarify which C functions are safe to be called before Py_Initialize() #76267

Closed

Description

@vstinner
BPO 32086
Nosy @ncoghlan, @vstinner, @ned-deily, @ericsnowcurrently, @serhiy-storchaka, @AraHaan
Superseder
  • bpo-32096: Py_DecodeLocale() fails if used before the runtime is initialized.
  • 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 2017-11-21.15:49:51.916>
    created_at = <Date 2017-11-20.14:21:16.388>
    labels = ['interpreter-core', '3.7', 'release-blocker']
    title = 'C API: Clarify which C functions are safe to be called before Py_Initialize()'
    updated_at = <Date 2017-11-21.15:49:51.914>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2017-11-21.15:49:51.914>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-11-21.15:49:51.916>
    closer = 'vstinner'
    components = ['Interpreter Core']
    creation = <Date 2017-11-20.14:21:16.388>
    creator = 'vstinner'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 32086
    keywords = []
    message_count = 7.0
    messages = ['306544', '306588', '306589', '306590', '306615', '306632', '306657']
    nosy_count = 6.0
    nosy_names = ['ncoghlan', 'vstinner', 'ned.deily', 'eric.snow', 'serhiy.storchaka', 'Decorater']
    pr_nums = []
    priority = 'release blocker'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '32096'
    type = None
    url = 'https://bugs.python.org/issue32086'
    versions = ['Python 3.7']

    Activity

    1. vstinner commented on Nov 20, 2017

      @vstinner
      MemberAuthor
    2. AraHaan commented on Nov 20, 2017

      AraHaanmannequin
      Mannequin

      For me, it looks like Py_DecodeLocal() is still safe (according to python 3.6.3 unless anything changed in it).

    3. vstinner commented on Nov 20, 2017

      @vstinner
      MemberAuthor

      For me, it looks like Py_DecodeLocal() is still safe (according to python 3.6.3 unless anything changed in it).

      This issue is a regression in Python 3.7.

    4. AraHaan commented on Nov 20, 2017

      AraHaanmannequin
      Mannequin

      Ah, I see now.

    5. ncoghlan commented on Nov 21, 2017

      @ncoghlan
      Contributor

      bpo-32096 covers reverting the change to PyDecode_Locale specifically for 3.7.

      We can use this issue to ask the broader question "Do we want to *deprecate* our previously implied support for calling PyDecode_Locale() before Py_Initialize()?"

      If the answer is "Yes", then we need to design a transition plan to a different API for setting config parameters that accept "wchar_t *".

      If the answer is "No", then we need to document that design constraint on the affected APIs.

      Either way, we should also improve the way we communicate the list of C API methods that can be safely called before Py_Initialize.

    6. serhiy-storchaka commented on Nov 21, 2017

      @serhiy-storchaka
      Member

      Is there a *need* to break existing code? What is the benefit and how large it in comparison with the necessary of rewriting every code that embeds Python (and supporting both ways for long time)?

    7. vstinner commented on Nov 21, 2017

      @vstinner
      MemberAuthor

      I mark this issue as a duplicate of bpo-32096.

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

    No one assigned

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions