summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorscoder <stefan_ml@behnel.de>2021-04-28 14:03:19 (GMT)
committerGitHub <noreply@github.com>2021-04-28 14:03:19 (GMT)
commit4c49be766897968e509c41397e0e624c25b1675d (patch)
tree205c4c622a0838de987bab81e43e13368f7e346e /Doc
parentfe52eb62191e640e720d184a9a1a04e965b8a062 (diff)
downloadcpython-4c49be766897968e509c41397e0e624c25b1675d.zip
cpython-4c49be766897968e509c41397e0e624c25b1675d.tar.gz
cpython-4c49be766897968e509c41397e0e624c25b1675d.tar.bz2
bpo-43959: clarify the documentation of the PyContextVar C-API (GH-25671)
Automerge-Triggered-By: GH:scoder
Diffstat (limited to 'Doc')
-rw-r--r--Doc/c-api/contextvars.rst13
1 files changed, 6 insertions, 7 deletions
diff --git a/Doc/c-api/contextvars.rst b/Doc/c-api/contextvars.rst
index 9c08881..d970f54 100644
--- a/Doc/c-api/contextvars.rst
+++ b/Doc/c-api/contextvars.rst
@@ -107,9 +107,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)
@@ -124,13 +124,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)