-
-
Notifications
You must be signed in to change notification settings - Fork 30.8k
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
gh-107305: Update the C-API Docs for PEP 684 #107324
Conversation
Doc/c-api/init.rst
Outdated
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Doc/c-api/init.rst
Outdated
Otherwise it will use (share) the main interpreter's. | ||
|
||
If this is ``0`` then | ||
:c:member:`PyInterpreterConfig.check_multi_interp_extensions` |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Doc/c-api/init.rst
Outdated
:c:member:`PyInterpreterConfig.use_main_obmalloc` must be ``0``. | ||
|
||
|
||
.. c:function:: PyThreadState* Py_NewInterpreterFromConfig(PyInterpreterConfig *config) |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Doc/c-api/init.rst
Outdated
@@ -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() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.. c:function:: PyThreadState* Py_NewInterpreter() | |
.. c:function:: PyThreadState* Py_NewInterpreter(void) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Doc/c-api/init.rst
Outdated
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` |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Doc/c-api/init.rst
Outdated
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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Doc/c-api/init.rst
Outdated
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 |
There was a problem hiding this comment.
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*
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The formatting LGTM.
Thanks @ericsnowcurrently for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12. |
Thanks for the reviews, @serhiy-storchaka |
GH-107402 is a backport of this pull request to the 3.12 branch. |
(cherry picked from commit c0b81c4) Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
📚 Documentation preview 📚: https://cpython-previews--107324.org.readthedocs.build/