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

Docs: Clarify generator.close() behavior regarding GeneratorExit by suryansh18saxena · Pull Request #135819 · python/cpython · GitHub

Repository navigation

Docs: Clarify generator.close() behavior regarding GeneratorExit - #135819

Closed
suryansh18saxena wants to merge 1 commit into
python:mainfrom
suryansh18saxena:fix-generator-doc
Closed

suryansh18saxena wants to merge 1 commit into
python:mainfrom
suryansh18saxena:fix-generator-doc

Conversation

suryansh18saxena commented Jun 22, 2025 •
edited by github-actions Bot
Loading

Copy link
Copy Markdown

gh-135110: Clarify that generator.close() does not externally raise GeneratorExit

Where: gh-135110 refers to the GitHub issue number being fixed.

This change addresses a documentation inconsistency where it was previously implied that generator.close() raises a GeneratorExit externally. However, this exception is raised inside the generator at the suspension point, and if not handled, it fails silently without propagating.

This change helps new users clearly understand how close() behaves when called on a generator.

Closes: gh-135110
-->


📚 Documentation preview 📚: https://cpython-previews--135819.org.readthedocs.build/

python-cla-bot Bot commented Jun 22, 2025 •
edited
Loading

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

Copy link
Copy Markdown
Author

I have opened PR #135819 that clarifies the documentation. Kindly review. Thanks!

Copy link
Copy Markdown
Member

Hi, thanks for contributing!

There's already an open PR for this issue: #135152. That's already been approved, so I think this probably won't land.
Sorry :(

picnixz commented Jun 22, 2025

Copy link
Copy Markdown
Member

Closing as a duplicate then. In the future, look at the end of the issue to see if a PR already exists. TiA.

picnixz closed this Jun 22, 2025
suryansh18saxena deleted the fix-generator-doc branch June 22, 2025 17:21
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.

generator.close() never raises GeneratorExit

3 participants


Back | FazBrowse Home | New Git URL