-
-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
bpo-33592: Document the C API in PEP 567 (contextvars) #7033
Conversation
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.
Thanks @elprans!
LGTM, but please add few notes about error cases.
Doc/c-api/contextvars.rst
Outdated
.. c:function:: int PyContext_CheckExact(PyObject *o) | ||
|
||
Return true if *o* is of type :c:data:`PyContext_Type`. *o* must not be | ||
*NULL*. |
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.
Please add "This function always succeeds." (and for two functions below).
Doc/c-api/contextvars.rst
Outdated
.. c:function:: int PyContext_ClearFreeList() | ||
|
||
Clear the context variable free list. Return the total number of | ||
freed items. |
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.
"This function always succeeds."
Doc/c-api/contextvars.rst
Outdated
|
||
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. |
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.
Mention that NULL is returned on error.
3bc5844
to
96ecdcc
Compare
96ecdcc
to
8e4531a
Compare
Merged, thanks @elprans! Also thanks to @serhiy-storchaka for the review! |
(cherry picked from commit b2f5f59) Co-authored-by: Elvis Pranskevichus <elvis@magic.io>
GH-7059 is a backport of this pull request to the 3.7 branch. |
https://bugs.python.org/issue33592