Title: Document PyInterpreterState_Main().
Type: Stage: resolved
Components: Documentation Versions: Python 3.8, Python 3.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, eric.snow, miss-islington, nanjekyejoannah
Priority: normal Keywords: easy, patch

Created on 2019-03-01 16:36 by eric.snow, last changed 2019-04-01 15:22 by eric.snow. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 12238 merged nanjekyejoannah, 2019-03-08 15:30
PR 12650 merged miss-islington, 2019-04-01 15:09
Messages (8)
msg336929 - (view) Author: Eric Snow (eric.snow) * (Python committer) Date: 2019-03-01 16:36
PyInterpreterState_Main() is a function in the public C-API that returns a pointer to the main interpreter's state.  The main interpreter is the first one created by the CPython runtime during startup (e.g. when the "python" command is run).

Documentation for PyInterpreterState_Main() should be on the "Initialization, Finalization, and Threads" page of the C-API docs, probably in the "Sub-interpreter support" section. [1]  It could also possibly go in the "Advanced Debugger Support" section. [2]

FYI, I added PyInterpreterState_Main() at PyCon US 2017 (commit f5df46d701d29baf738365da6fcf1b8a3ceabb71) when I merged Nick Coghlan's internal implementation of PEP 432.  So it has been available since 3.7.

msg336996 - (view) Author: Joannah Nanjekye (nanjekyejoannah) * (Python committer) Date: 2019-03-02 06:50
@Mariatta do you want to keep this for the mentored sprint at PyCon?
msg337496 - (view) Author: Joannah Nanjekye (nanjekyejoannah) * (Python committer) Date: 2019-03-08 15:43
Since there was no response, I decided to  open a PR for this.
msg339151 - (view) Author: Eric Snow (eric.snow) * (Python committer) Date: 2019-03-29 21:20
As I noted on the PR, this might be a good chance to make sure the C-API docs are clear about what the "main" interpreter is.
msg339209 - (view) Author: Joannah Nanjekye (nanjekyejoannah) * (Python committer) Date: 2019-03-30 16:07
I will work on this in a separate PR.

I opened #issue36487 ( to track this.
msg339297 - (view) Author: miss-islington (miss-islington) Date: 2019-04-01 15:08
New changeset 8c61739defd88c7f79e86537886c33745843ce01 by Miss Islington (bot) (Joannah Nanjekye) in branch 'master':
bpo-36157:Document PyInterpreterState_Main() (GH-12238)
msg339298 - (view) Author: miss-islington (miss-islington) Date: 2019-04-01 15:15
New changeset 35fc38e5e82d18ceec95af9af2103319497e2eaf by Miss Islington (bot) in branch '3.7':
bpo-36157:Document PyInterpreterState_Main() (GH-12238)
msg339299 - (view) Author: Eric Snow (eric.snow) * (Python committer) Date: 2019-04-01 15:22
Thanks for working on this, Joannah!  :)
Date User Action Args
2019-04-01 15:22:42eric.snowsetstatus: open -> closed
resolution: fixed
messages: + msg339299

stage: patch review -> resolved
2019-04-01 15:15:16miss-islingtonsetmessages: + msg339298
2019-04-01 15:09:34miss-islingtonsetkeywords: + patch
stage: commit review -> patch review
pull_requests: + pull_request12581
2019-04-01 15:08:59miss-islingtonsetnosy: + miss-islington
messages: + msg339297
2019-03-30 16:07:43nanjekyejoannahsetmessages: + msg339209
2019-03-29 21:20:17eric.snowsetmessages: + msg339151
2019-03-13 01:21:31cheryl.sabellasetstage: needs patch -> commit review
2019-03-08 15:43:45nanjekyejoannahsetkeywords: - patch

messages: + msg337496
stage: patch review -> needs patch
2019-03-08 15:30:54nanjekyejoannahsetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request12226
2019-03-02 06:50:40nanjekyejoannahsetnosy: + nanjekyejoannah
messages: + msg336996
2019-03-01 16:36:40eric.snowcreate