Skip to content

[3.8] bpo-43959: clarify the documentation of the PyContextVar C-API (GH-25671) #25690

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

Merged
merged 1 commit into from
Apr 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions Doc/c-api/contextvars.rst
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ Context variable functions:
.. c:function:: PyObject *PyContextVar_New(const char *name, PyObject *def)

Create a new ``ContextVar`` object. The *name* parameter is used
for introspection and debug purposes. The *def* parameter may optionally
specify the default value for the context variable. If an error has
occurred, this function returns ``NULL``.
for introspection and debug purposes. The *def* parameter specifies
a default value for the context variable, or ``NULL`` for no default.
If an error has occurred, this function returns ``NULL``.

.. c:function:: int PyContextVar_Get(PyObject *var, PyObject *default_value, PyObject **value)

Expand All @@ -129,13 +129,12 @@ Context variable functions:
- the default value of *var*, if not ``NULL``;
- ``NULL``

If the value was found, the function will create a new reference to it.
Except for ``NULL``, the function returns a new reference.

.. c:function:: PyObject *PyContextVar_Set(PyObject *var, PyObject *value)

Set the value of *var* to *value* in the current context. Returns a
pointer to a :c:type:`PyObject` object, or ``NULL`` if an error
has occurred.
Set the value of *var* to *value* in the current context. Returns
a new token object for this change, or ``NULL`` if an error has occurred.

.. c:function:: int PyContextVar_Reset(PyObject *var, PyObject *token)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The documentation on the PyContextVar C-API was clarified.