Skip to content

gh-162601: Document the saved exception in finally - #162688

Closed
subotac wants to merge 1 commit into
python:mainfrom
subotac:docs/finally-saved-exception
Closed

subotac wants to merge 1 commit into
python:mainfrom
subotac:docs/finally-saved-exception

Conversation

@subotac

@subotac subotac commented Nov 26, 2026 •

Copy link
Copy Markdown

Fixes #162601.

Clarify that on entry to finally, a saved exception is available through sys.exception() and can be re-raised with a bare raise.

Verified both behaviors on CPython 3.15.2 and built the HTML documentation with warnings treated as errors.

@python-cla-bot

python-cla-bot Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #36190914 | 📁 Comparing 789a96c against main (572ec16)

  🔍 Preview build  

1 file changed
± reference/compound_stmts.html

@picnixz

picnixz commented Nov 26, 2026

Copy link
Copy Markdown
Member

I still don't know if this is correct. Is it the case for EVERY python implementation as well? this may be a CPython detail though.

@picnixz picnixz closed this Nov 26, 2026
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.

Docs: the Reference says the exception is not available in a finally clause, but sys.exception() and a bare raise see it

2 participants