FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-134537: Clarify context manager reuse in ContextDecorator by limadog9 · Pull Request #159848 · python/cpython · GitHub

Repository navigation

gh-134537: Clarify context manager reuse in ContextDecorator - #159848

Open
limadog9 wants to merge 1 commit into
python:mainfrom
limadog9:gh-134537-contextdecorator-reuse-docs
Open

limadog9 wants to merge 1 commit into
python:mainfrom
limadog9:gh-134537-contextdecorator-reuse-docs

Conversation

limadog9 commented Oct 20, 2026 •
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Contributor

Correct the ContextDecorator equivalence example to reuse one context manager instance across calls. The previous example constructed a new instance inside the function, which can behave differently for stateful managers.

Clarify the requirements for recursive and concurrent calls, and distinguish the per-call recreation provided by contextmanager().

Fixes #134537.

Validation:

  • Verified shared instance identity across sequential and recursive decorated calls, and distinct contexts for a generator-based decorator, on the current free-threaded debug build.
  • Full HTML documentation build with warnings treated as errors.
  • Sphinx lint and patchcheck.

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #35258702 | 📁 Comparing 26d52a9 against main (6044c62)

  🔍 Preview build  

1 file changed
± library/contextlib.html

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review docs Documentation in the Doc dir skip news

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

ContextDecorator documentation is unclear.

1 participant


Back | FazBrowse Home | New Git URL