homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Use `raise from` when raising new IncompleteRead
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.11
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: cool-RR, iritkatriel, miss-islington, wangjiahua
Priority: normal Keywords: easy, patch

Created on 2016年12月12日 21:43 by cool-RR, last changed 2022年04月11日 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
1.patch cool-RR, 2016年12月12日 21:43 review
Pull Requests
URL Status Linked Edit
PR 29861 merged wangjiahua, 2021年11月30日 10:43
Messages (8)
msg283052 - (view) Author: Ram Rachum (cool-RR) * Date: 2016年12月12日 21:43
I had this error come up in my code, and because it doesn't use `raise ... from` I thought that the second error was unexpected, while in fact it wasn't. This patch should fix that.
msg407608 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2021年12月03日 22:02
I just pushed a new feature which may provide a simpler way to do this: https://bugs.python.org/issue45607 
msg407645 - (view) Author: Ram Rachum (cool-RR) * Date: 2021年12月04日 07:26
Interesting feature Irit, thank you 
Two things:
1. Is there better documentation for that feature than what was in the CL of the issue you linked to? Because that documentation was more lawyery than explanatory.
2. If I understand correctly, the note is meant for things that don't exactly fit in the exception message for some reason or another. (A better documentation with examples would have given me a clearer understanding of your use cases.) I'm not sure why the message included here should be relegated to a note.
msg407651 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2021年12月04日 09:57
It’s meant for thing you want to add to the msg after the exception was created. The PR here seems to create a new exception of the same type in order to chain it with an additional msg. I’m suggesting that it might be sufficient to attach a note to the existing exception instead.
msg407655 - (view) Author: Ram Rachum (cool-RR) * Date: 2021年12月04日 10:24
This might work here, but you'd need to be sure there isn't any important code that looks at the IncompleteRead exception and expects the data to be in its message.
Also I hope that various tools like IDEs would learn quickly that they need to display the note in their traceback views, otherwise all of these notes would be hidden from many people.
msg407657 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2021年12月04日 10:53
Exception message text is not part of the api. The type is.
msg407659 - (view) Author: Ram Rachum (cool-RR) * Date: 2021年12月04日 10:58
Okay, works for me.
msg407882 - (view) Author: miss-islington (miss-islington) Date: 2021年12月07日 00:10
New changeset c5c365220ed2c867fe81078f70b827de22db2ee6 by 180909 in branch 'main':
bpo-28953: Use `raise from` when raising new IncompleteRead (GH-29861)
https://github.com/python/cpython/commit/c5c365220ed2c867fe81078f70b827de22db2ee6
History
Date User Action Args
2022年04月11日 14:58:40adminsetgithub: 73139
2021年12月07日 00:13:07asvetlovsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2021年12月07日 00:10:56miss-islingtonsetnosy: + miss-islington
messages: + msg407882
2021年12月04日 10:58:36cool-RRsetmessages: + msg407659
2021年12月04日 10:53:10iritkatrielsetmessages: + msg407657
2021年12月04日 10:24:25cool-RRsetmessages: + msg407655
2021年12月04日 09:57:26iritkatrielsetmessages: + msg407651
2021年12月04日 07:26:13cool-RRsetmessages: + msg407645
2021年12月03日 22:02:59iritkatrielsetnosy: + iritkatriel
messages: + msg407608
2021年11月30日 10:43:44wangjiahuasetnosy: + wangjiahua

pull_requests: + pull_request28088
stage: patch review
2021年06月22日 21:31:52iritkatrielsetkeywords: + easy
versions: + Python 3.11, - Python 3.7
2016年12月12日 21:43:40cool-RRsettype: behavior
2016年12月12日 21:43:13cool-RRcreate

AltStyle によって変換されたページ (->オリジナル) /