mirror of https://github.com/python/cpython
bpo-43959: clarify the documentation of the PyContextVar C-API (GH-25671)
Automerge-Triggered-By: GH:scoder
This commit is contained in:
parent
fe52eb6219
commit
4c49be7668
|
@ -107,9 +107,9 @@ Context variable functions:
|
||||||
.. c:function:: PyObject *PyContextVar_New(const char *name, PyObject *def)
|
.. c:function:: PyObject *PyContextVar_New(const char *name, PyObject *def)
|
||||||
|
|
||||||
Create a new ``ContextVar`` object. The *name* parameter is used
|
Create a new ``ContextVar`` object. The *name* parameter is used
|
||||||
for introspection and debug purposes. The *def* parameter may optionally
|
for introspection and debug purposes. The *def* parameter specifies
|
||||||
specify the default value for the context variable. If an error has
|
a default value for the context variable, or ``NULL`` for no default.
|
||||||
occurred, this function returns ``NULL``.
|
If an error has occurred, this function returns ``NULL``.
|
||||||
|
|
||||||
.. c:function:: int PyContextVar_Get(PyObject *var, PyObject *default_value, PyObject **value)
|
.. 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``;
|
- the default value of *var*, if not ``NULL``;
|
||||||
- ``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)
|
.. c:function:: PyObject *PyContextVar_Set(PyObject *var, PyObject *value)
|
||||||
|
|
||||||
Set the value of *var* to *value* in the current context. Returns a
|
Set the value of *var* to *value* in the current context. Returns
|
||||||
pointer to a :c:type:`PyObject` object, or ``NULL`` if an error
|
a new token object for this change, or ``NULL`` if an error has occurred.
|
||||||
has occurred.
|
|
||||||
|
|
||||||
.. c:function:: int PyContextVar_Reset(PyObject *var, PyObject *token)
|
.. c:function:: int PyContextVar_Reset(PyObject *var, PyObject *token)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
The documentation on the PyContextVar C-API was clarified.
|
Loading…
Reference in New Issue