Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-107305: Update the C-API Docs for PEP 684 #107324

Merged
merged 14 commits into from
Jul 28, 2023

Conversation

ericsnowcurrently
Copy link
Member

@ericsnowcurrently ericsnowcurrently commented Jul 26, 2023

This determines the operation of the GIL for the sub-interpreter.
It may be one of the following:

- ``PyInterpreterConfig_DEFAULT_GIL``: use the default selection
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use .. c:macro:: for declaring these constant and the :c:macro: role for referring them. They will also be added in the index.

Just add .. c:namespace:: NULL before this, otherwise they will have wrong prefix.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Otherwise it will use (share) the main interpreter's.

If this is ``0`` then
:c:member:`PyInterpreterConfig.check_multi_interp_extensions`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps :c:member:`~PyInterpreterConfig.check_multi_interp_extensions` or just :c:member:`check_multi_interp_extensions` would look better.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

:c:member:`PyInterpreterConfig.use_main_obmalloc` must be ``0``.


.. c:function:: PyThreadState* Py_NewInterpreterFromConfig(PyInterpreterConfig *config)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If config is not modified, perhaps add const?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -1287,19 +1398,79 @@ function. You can create and destroy them using the following functions:
.. index:: single: close() (in module os)


.. c:function:: PyThreadState* Py_NewInterpreter()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.. c:function:: PyThreadState* Py_NewInterpreter()
.. c:function:: PyThreadState* Py_NewInterpreter(void)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

If this is ``0`` then
:c:member:`~PyInterpreterConfig.check_multi_interp_extensions`
must be ``1`` (non-zero).
If this is ``1`` then :c:member:`PyInterpreterConfig.gil`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the prefix can be omitted here too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

including legacy (single-phase init) modules,
in any thread where the sub-interpreter is currently active.
Otherwise only multi-phase init extension modules
(see :ref:`Isolating Extension Modules`) may be imported.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An explicit label is required to refer across files.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

The given config controls the options with which the interpreter
is initialized.

Upon success, the ``tstate_p`` arg will be set to the first thread state
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function parameters are marked like *tstate_p*.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The formatting LGTM.

@miss-islington
Copy link
Contributor

Thanks @ericsnowcurrently for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

@ericsnowcurrently
Copy link
Member Author

Thanks for the reviews, @serhiy-storchaka

@bedevere-bot
Copy link

GH-107402 is a backport of this pull request to the 3.12 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.12 bug and security fixes label Jul 28, 2023
@ericsnowcurrently ericsnowcurrently deleted the pep-684-docs-1 branch July 28, 2023 19:47
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 28, 2023
(cherry picked from commit c0b81c4)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
ericsnowcurrently added a commit that referenced this pull request Jul 28, 2023
…07402)

gh-107305: Update the C-API Docs for PEP 684 (gh-107324)
(cherry picked from commit c0b81c4)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants