-
-
Notifications
You must be signed in to change notification settings - Fork 32k
bpo-42179: Clarify exception chaining #23160
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
Conversation
Clarify exception chaining behaviour and give a reference to the library documentation.
Wording
Spelling
I agree with @methane that this degree of detail is too much for the tutorial. |
@merwok can you post (and elaborate) your opinion in the BPO ticket? I think it's better to keep discussion on the change in one place. I can reduce degree of detail, too. |
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.
Thanks @greatvovan for the PR. Let's update this after #23162 lands. I like the sentence that I've flagged and think it would be helpful.
Doc/tutorial/errors.rst
Outdated
inside an exception handler or :keyword:`finally` section. Exception chaining | ||
can be disabled by using ``from None`` idiom: | ||
inside an exception handler or :keyword:`finally` section, however in this case | ||
``__context__`` attribute of the exception is used. Chaining with |
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.
I recommend submitting this sentence right before the builtin exceptions sentence after #23162 lands. Then add "Chaining with ... takes priority."
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase And if you don't make the requested changes, you will be poked with soft cushions! |
I have made the requested changes; please review again. @willingc the sentence you suggested could not be used as is in the new variant of text as the context is bit lost after removing mentions of special attributes. I added a new abstract in the end of the section, please let me know what you think. |
Thanks for making the requested changes! @willingc: please review the changes made to this pull request. |
@@ -281,17 +281,17 @@ chaining exceptions. For example:: | |||
This can be useful when you are transforming exceptions. For example:: | |||
|
|||
>>> def func(): | |||
... raise IOError | |||
... raise ConnectionError |
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.
Nice! One OSError was missed on line 294
Remove mentioning of special attributes as folks think it's too much for beginners.
Please review the final version. I removed my proposal paragraph about |
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.
Thanks @greatvovan and good catch on ConnectionError. @merwok If you are good with this as it stands, please merge. Thanks ☀️
This PR is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 5 days |
Thanks for merging Carol! FYI the commit message is messy due to github’s poor UI. |
Sorry about the commit message. Thanks @merwok. |
* Update errors.rst Clarify exception chaining behaviour and give a reference to the library documentation. * Update errors.rst Wording * Update errors.rst Spelling * Update errors.rst Remove mentioning of special attributes as folks think it's too much for beginners.
Add an important detail and provide a link.
https://bugs.python.org/issue42179