-
-
Notifications
You must be signed in to change notification settings - Fork 31.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
gh-124872: Refine contextvars documentation #124773
Conversation
c99ca89
to
b16f493
Compare
* Add definitions for "context", "current context", and "context management protocol". * Update related definitions to be consistent with the new definitions. * Restructure the documentation for the `contextvars.Context` class to prepare for adding context manager support, and for consistency with the definitions. * Use `testcode` and `testoutput` to test the `Context.run` example. * Expand the documentation for the `Py_CONTEXT_EVENT_ENTER` and `Py_CONTEXT_EVENT_EXIT` events to clarify and to prepare for planned changes.
b16f493
to
c38c1c6
Compare
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.
Excellent stuff. Thank you.
Huge +1. |
Sorry, @rhansen and @1st1, I could not cleanly backport this to
|
@rhansen can you submit a PR against 3.13 please? |
GH-125233 is a backport of this pull request to the 3.13 branch. |
I opened issue pythongh-124872 after creating PR pythongh-124773 but forgot to rename the blurb file to match the new issue number. (The cherry-pick to 3.13 in pythongh-125233 already uses this new filename.)
[3.13] gh-124872: Refine contextvars documentation * Add definitions for "context", "current context", and "context management protocol". * Update related definitions to be consistent with the new definitions. * Restructure the documentation for the `contextvars.Context` class to prepare for adding context manager support, and for consistency with the definitions. * Use `testcode` and `testoutput` to test the `Context.run` example. (cherry-picked from commit 9940093) Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
contextvars.Context
class to prepare for adding context manager support, and for consistency with the definitions.testcode
andtestoutput
to test theContext.run
example.Py_CONTEXT_EVENT_ENTER
andPy_CONTEXT_EVENT_EXIT
events to clarify and to prepare for planned changes.cc @fried
contextvars.Context
#99633📚 Documentation preview 📚: https://cpython-previews--124773.org.readthedocs.build/