Title: [subinterpreters] Test Py_Finalize() from a subinterpreter
Type: Stage: patch review
Components: Subinterpreters, Tests Versions: Python 3.9
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: LewisGaul, eric.snow, nanjekyejoannah, ncoghlan, vstinner
Priority: normal Keywords: patch

Created on 2019-08-06 17:43 by nanjekyejoannah, last changed 2020-10-25 15:55 by LewisGaul.

Pull Requests
URL Status Linked Edit
PR 17575 open LewisGaul, 2020-10-25 15:55
Messages (4)
msg349123 - (view) Author: Joannah Nanjekye (nanjekyejoannah) * (Python committer) Date: 2019-08-06 17:43
Am opening a test request from @ncoghlan from the discussing on issue 36225.

There is a need to add a test that exercises what happens when Py_Finalize() is called from a sub-interpreter rather than the main interpreter.
msg358349 - (view) Author: Lewis Gaul (LewisGaul) * Date: 2019-12-13 18:21
It seems that test_audit_subinterpreter() in _testembed.c was (unintentionally?) doing this already.

After fixing #36225 I found this testcase causes a segfault, but works fine when switching back to the main threadstate before calling Py_Finalize().

So it looks like adding a specific testcase for this is likely to weed out an actual issue here!
msg358357 - (view) Author: Eric Snow (eric.snow) * (Python committer) Date: 2019-12-13 21:33
On Fri, Dec 13, 2019 at 11:22 AM Lewis Gaul <> wrote:
> So it looks like adding a specific testcase for this is likely to weed out an actual issue here!

msg363786 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-03-09 23:22
See also bpo-38865.
Date User Action Args
2020-10-25 15:55:15LewisGaulsetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request21890
2020-05-15 00:40:17vstinnersetcomponents: + Subinterpreters
title: Test Py_Finalize() from a subinterpreter -> [subinterpreters] Test Py_Finalize() from a subinterpreter
2020-03-09 23:22:05vstinnersetnosy: + vstinner
messages: + msg363786
2019-12-13 21:33:48eric.snowsetmessages: + msg358357
2019-12-13 18:21:58LewisGaulsetnosy: + LewisGaul
messages: + msg358349
2019-08-06 17:46:05nanjekyejoannahsetstage: needs patch
components: + Tests
versions: + Python 3.9
2019-08-06 17:43:30nanjekyejoannahcreate