Issue 28953: Use raise from when raising new IncompleteRead (original) (raw)

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:40 admin set github: 73139
2021-12-07 00:13:07 asvetlov set status: open -> closedresolution: fixedstage: patch review -> resolved
2021-12-07 00:10:56 miss-islington set nosy: + miss-islingtonmessages: +
2021-12-04 10:58:36 cool-RR set messages: +
2021-12-04 10:53:10 iritkatriel set messages: +
2021-12-04 10:24:25 cool-RR set messages: +
2021-12-04 09:57:26 iritkatriel set messages: +
2021-12-04 07:26:13 cool-RR set messages: +
2021-12-03 22:02:59 iritkatriel set nosy: + iritkatrielmessages: +
2021-11-30 10:43:44 wangjiahua set nosy: + wangjiahuapull_requests: + <pull%5Frequest28088>stage: patch review
2021-06-22 21:31:52 iritkatriel set keywords: + easyversions: + Python 3.11, - Python 3.7
2016-12-12 21:43:40 cool-RR set type: behavior
2016-12-12 21:43:13 cool-RR create