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.
Created on 2019年05月24日 08:08 by vstinner, last changed 2022年04月11日 14:59 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 13537 | merged | vstinner, 2019年05月24日 08:12 | |
| PR 13538 | merged | vstinner, 2019年05月24日 08:19 | |
| Messages (3) | |||
|---|---|---|---|
| msg343350 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2019年05月24日 08:08 | |
Currently, signalmodule.c tracks the "main thread" and the "main interpreter": main_thread = PyThread_get_thread_ident(); main_interp = _PyInterpreterState_Get(); This information is already tracked in the global _PyRuntime variable which is updated at fork by _PyRuntimeState_ReInitThreads() (called by PyOS_AfterFork_Child). Attached PR removes main_thread and main_interp from signalmodule.c, to reuse _PyRuntime. It should help to ensure that Python remains consistent (less risk of inconsistency if one variable is updated, but not the other). By the way, _PyInterpreterState_DeleteExceptMain() is called before _PyRuntimeState_ReInitThreads(). _PyInterpreterState_DeleteExceptMain() acquires runtime->interpreters.mutex, whereas this lock is reset by _PyRuntimeState_ReInitThreads(). Maybe I introduced this bug recently when I refactored code, I don't know. But it sounds like a bug as well. Note: PyOS_AfterFork_Child() doesn't update runtime->interpreters->main, but os.fork() raises a RuntimeError if it's not called from the main interpreter. So it's fine. |
|||
| msg343379 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2019年05月24日 11:43 | |
New changeset d8613dc86f4c7acd3e2598095c466fe9dc0ad27c by Victor Stinner in branch 'master': bpo-37031: Reuse _PyRuntime.main_thread in signalmodule.c (GH-13538) https://github.com/python/cpython/commit/d8613dc86f4c7acd3e2598095c466fe9dc0ad27c |
|||
| msg343385 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2019年05月24日 13:20 | |
New changeset b49858b4b7b4c9d85ef6946ad020f83e4fa1caa7 by Victor Stinner in branch 'master': bpo-37031: Fix PyOS_AfterFork_Child() (GH-13537) https://github.com/python/cpython/commit/b49858b4b7b4c9d85ef6946ad020f83e4fa1caa7 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:59:15 | admin | set | github: 81212 |
| 2019年05月24日 13:20:42 | vstinner | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2019年05月24日 13:20:27 | vstinner | set | messages: + msg343385 |
| 2019年05月24日 11:43:59 | vstinner | set | messages: + msg343379 |
| 2019年05月24日 09:27:22 | mcepl | set | nosy:
+ mcepl |
| 2019年05月24日 08:19:55 | vstinner | set | pull_requests: + pull_request13453 |
| 2019年05月24日 08:12:44 | vstinner | set | keywords:
+ patch stage: patch review pull_requests: + pull_request13452 |
| 2019年05月24日 08:08:57 | vstinner | create | |