Skip to content
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

Merged
merged 1 commit into from
May 22, 2018

Conversation

elprans
Copy link
Contributor

@elprans elprans commented May 21, 2018

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a 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.

.. c:function:: int PyContext_CheckExact(PyObject *o)

Return true if *o* is of type :c:data:`PyContext_Type`. *o* must not be
*NULL*.
Copy link
Member

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).

.. c:function:: int PyContext_ClearFreeList()

Clear the context variable free list. Return the total number of
freed items.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"This function always succeeds."


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.
Copy link
Member

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.

@elprans elprans force-pushed the document-contextvars-capi branch from 96ecdcc to 8e4531a Compare May 22, 2018 14:18
@1st1 1st1 merged commit b2f5f59 into python:master May 22, 2018
@miss-islington
Copy link
Contributor

Thanks @elprans for the PR, and @1st1 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7.
🐍🍒⛏🤖

@1st1
Copy link
Member

1st1 commented May 22, 2018

Merged, thanks @elprans! Also thanks to @serhiy-storchaka for the review!

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 22, 2018
(cherry picked from commit b2f5f59)

Co-authored-by: Elvis Pranskevichus <elvis@magic.io>
@bedevere-bot
Copy link

GH-7059 is a backport of this pull request to the 3.7 branch.

miss-islington added a commit that referenced this pull request May 22, 2018
(cherry picked from commit b2f5f59)

Co-authored-by: Elvis Pranskevichus <elvis@magic.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants