GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Expose _Py_NewInterpreter() as Py_NewInterpreterFromConfig() · Issue #98608 · python/cpython

Expose _Py_NewInterpreter() as Py_NewInterpreterFromConfig() #98608

New issue
Copy link
New issue
Copy link
Closed
Closed
Expose _Py_NewInterpreter() as Py_NewInterpreterFromConfig()#98608
Copy link
Assignees
ericsnowcurrently
Labels
3.12only security fixesonly security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-subinterpreterstype-featureA feature request or enhancementA feature request or enhancement

Description

@ericsnowcurrently
ericsnowcurrently
opened on Oct 24, 2022
Issue body actions

A while back I added _Py_NewInterpreter() (a "private" API) to support configuring the new interpreter. Ultimately, I'd like to adjust
the signature a little and then make the function part of the public API (as Py_NewInterpreterFromConfig()).

My plan:

  1. change the argument to a new _PyInterpreterConfig struct
  2. rename the function to Py_NewInterpreterFromConfig(), inspired by Py_InitializeFromConfig() (takes a PyInterpreterConfig instead of isolated_subinterpreter)
  3. split up the boolean isolated_subinterpreter into the corresponding multiple granular settings
    • allow_fork
    • allow_subprocess
    • allow_threads
  4. drop PyConfig._isolated_interpreter

Note that the current default (Py_NewInterpeter() and Py_Initialize*()) allows fork, subprocess, and threads, and the optional "isolated" interpreter disables all three. I'm not planning on changing any of that here.

My main objective here is to expose the existing API in a way that we can do the following afterward:

  • stop giving the option to disallow subprocess (i.e. drop PyInterpreterConfig.allow_subprocess)
  • add an option to disallow just "exec" instead
  • stop disallowing threads as a default behavior for an "isolated" interpreter (we'd still keep the option though)
  • add the option to disallow daemon threads
  • add an option to check if each extension supports running in multiple interpreters
  • add other options for PEP 684 (per-interpreter GIL)

Linked PRs

  • gh-98608: Stop Treating All Errors from _Py_NewInterpreterFromConfig() as Fatal #102657
  • gh-98608: Fix Failure-handling in new_interpreter() #102658
  • [3.11] gh-98608: Fix Failure-handling in new_interpreter() (gh-102658) #102882
  • [3.10] gh-98608: Fix Failure-handling in new_interpreter() (gh-102658) #102883
  • gh-98608: Move PyInterpreterConfig to pylifecycle.h #107191
  • [3.12] gh-98608: Move PyInterpreterConfig to pylifecycle.h (GH-107191) #107198

Activity

  1. ericsnowcurrently
    added
    type-featureA feature request or enhancementA feature request or enhancement
    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
    topic-subinterpreters
    3.12only security fixesonly security fixes
    on Oct 24, 2022
  2. ezio-melotti
    added this to Subinterpreterson Oct 24, 2022
  3. ericsnowcurrently
    moved this to In Review in Fancy CPython Boardon Oct 25, 2022
  4. ericsnowcurrently
    added this to Fancy CPython Boardon Oct 25, 2022
  5. ericsnowcurrently
    self-assigned this
    on Oct 25, 2022
  6. ericsnowcurrently
    added a commit that references this issue on Oct 26, 2022

    gh-98608: Change _Py_NewInterpreter() to _Py_NewInterpreterFromConfig…

    f323694
  7. ericsnowcurrently
    moved this to Done in Subinterpreterson Oct 26, 2022
  8. ericsnowcurrently
    closed this as completedon Oct 26, 2022
  9. Repository owner moved this from In Review to Done in Fancy CPython Boardon Oct 26, 2022
  10. ericsnowcurrently
    added 2 commits that reference this issue on Mar 21, 2023

    gh-98608: Stop Treating All Errors from _Py_NewInterpreterFromConfig(…

    3bb4756

    gh-98608: Fix Failure-handling in new_interpreter() (gh-102658)

    d1b883b
  11. miss-islington
    added 4 commits that reference this issue on Mar 21, 2023

    pythongh-98608: Fix Failure-handling in new_interpreter() (pythongh-1…

    ab2a432

    pythongh-98608: Fix Failure-handling in new_interpreter() (pythongh-1…

    4a8445d

    gh-98608: Fix Failure-handling in new_interpreter() (gh-102658)

    d5fdc3f

    gh-98608: Fix Failure-handling in new_interpreter() (gh-102658)

    4c6b354
  12. Fidget-Spinner
    added 2 commits that reference this issue on Mar 27, 2023

    pythongh-98608: Stop Treating All Errors from _Py_NewInterpreterFromC…

    8eb9d2f

    pythongh-98608: Fix Failure-handling in new_interpreter() (pythongh-1…

    ac24ffa
  13. warsaw
    added 2 commits that reference this issue on Apr 11, 2023

    pythongh-98608: Stop Treating All Errors from _Py_NewInterpreterFromC…

    3d9645b

    pythongh-98608: Fix Failure-handling in new_interpreter() (pythongh-1…

    45f7d84
  14. vstinner
    added 2 commits that reference this issue on Jul 24, 2023

    pythongh-98608: Move PyInterpreterConfig to pylifecycle.h

    81439be

    gh-98608: Move PyInterpreterConfig to pylifecycle.h (#107191)

    e717b47
  15. miss-islington
    added a commit that references this issue on Jul 24, 2023

    pythongh-98608: Move PyInterpreterConfig to pylifecycle.h (pythonGH-1…

    da8b409
  16. vstinner
    added a commit that references this issue on Jul 24, 2023

    [3.12] gh-98608: Move PyInterpreterConfig to pylifecycle.h (GH-107191) (

    5bf7165
  17. jtcave
    added a commit that references this issue on Jul 27, 2023

    pythongh-98608: Move PyInterpreterConfig to pylifecycle.h (python#107191

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

Metadata

Metadata

Assignees

  • @ericsnowcurrently
    ericsnowcurrently

Labels

3.12only security fixesonly security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-subinterpreterstype-featureA feature request or enhancementA feature request or enhancement

Projects

  • Subinterpreters
    Status
    Done
    Show more project fields

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.