➜

This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
标题: [subinterpreters] Add PyConfig._isolated_interpreter: isolated subinterpreters
类型: Stage: resolved
Components: Subinterpreters Versions: Python 3.9
process
状态: closed Resolution: fixed
Dependencies: 后续:
分配给: 抄送列表: barry, corona10, eric.snow, vstinner
优先级: normal 关键字: patch

Created on 2020-04-30 20:00 by vstinner, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 19820 merged vstinner, 2020-04-30 20:07
Messages (3)
msg367778 - (view) Author: STINNER Victor (vstinner) * (Python committer) 日期: 2020-04-30 20:00
I propose to add PyConfig._isolated_interpreter configuration parameter to disallow threads, subprocesses and fork in a subinterpreter.

_xxsubinterpreter.create() gets a new keyword-only isolated=True parameter to opt-in for not isolated mode, which is the current behavior of Py_NewInterpreter(). For example, mod_wsgi would continue to run in "non isolated" mode.

Attached PR implements this change. With the change, os.fork() is allowed again in "non isolated" subinterpreters (like mod_wsgi). os.fork() was disallowed in subinterpreters in Python 3.8, but subprocess was still allowed.
msg367830 - (view) Author: STINNER Victor (vstinner) * (Python committer) 日期: 2020-05-01 09:33
New changeset 252346acd937ddba4845331994b8ff4f90349625 by Victor Stinner in branch 'master':
bpo-40453: Add PyConfig._isolated_subinterpreter (GH-19820)
https://github.com/python/cpython/commit/252346acd937ddba4845331994b8ff4f90349625
msg367831 - (view) Author: STINNER Victor (vstinner) * (Python committer) 日期: 2020-05-01 09:34
TODO

* check that spawning a thread is blocked in isolated subinterpreter
* block loading C extensions which don't implement PEP 489 in isolated subinterpreter

(see https://github.com/python/cpython/pull/19820 comments)
历史
日期 用户 动作 参数
2022-04-11 14:59:30admin修改github: 84633
2021-09-21 20:05:07vstinner修改状态: open -> closed
resolution: fixed
stage: patch review -> resolved
2020-05-15 00:39:34vstinner修改components: + Subinterpreters, - Interpreter Core
标题: Add PyConfig._isolated_interpreter: isolated subinterpreters -> [subinterpreters] Add PyConfig._isolated_interpreter: isolated subinterpreters
2020-05-01 14:55:45eric.snow修改抄送: + eric.snow
2020-05-01 10:56:40corona10修改抄送: + corona10
2020-05-01 09:34:43vstinner修改消息: + msg367831
2020-05-01 09:33:51vstinner修改消息: + msg367830
2020-04-30 22:09:25barry修改抄送: + barry
2020-04-30 20:07:59vstinner修改keywords: + patch
stage: patch review
pull_requests: + pull_request19140
2020-04-30 20:00:57vstinner创建