➜

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
标题: Exception state lives too long in 3.0
类型: behavior Stage:
Components: Interpreter Core Versions: Python 3.0
process
状态: closed Resolution: fixed
Dependencies: 后续: Lexical exception handlers
View: 3021
分配给: 抄送列表: Rhamphoryncus, barry, benjamin.peterson, collinwinter, jyasskin, pitrou
优先级: critical 关键字: patch

Created on 2008-03-29 14:28 by pitrou, last changed 2022-04-11 14:56 by admin. This issue is now closed.

文件
文件名 上传时间 Description 编辑
exc_cleanup.patch pitrou, 2008-03-29 14:35
exc_cleanup2.patch pitrou, 2008-03-29 23:23
exc_cleanup3.patch pitrou, 2008-05-02 20:27
exc_cleanup4.patch pitrou, 2008-05-07 22:41
better_exc_cleanup.patch pitrou, 2008-05-24 22:35
Messages (18)
msg64697 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) 日期: 2008-03-29 14:28
See http://mail.python.org/pipermail/python-3000/2008-March/012830.html
: the exception state can survive across thread switches if the
enclosing frame is not destroyed immediately.
msg64698 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) 日期: 2008-03-29 14:35
And this is a patch, together with a test.
msg64734 - (view) Author: Jeffrey Yasskin (jyasskin) * (Python committer) 日期: 2008-03-29 22:50
Thanks for the patch. This isn't specific to threads at all, so the test
doesn't need to spawn a thread, just raise an exception from a nested
function with a parameter, catch it, delete the object the parameter
referred to, and then check that the object has been destroyed.

I don't know the exception handling code very well, so I'd like someone
more familiar with it to check that the patch is correct and efficient.
Collin, would you do the honors?
msg64736 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) 日期: 2008-03-29 23:23
You are right, threads aren't needed. So, attaching an updated patch.
msg64883 - (view) Author: Barry A. Warsaw (barry) * (Python committer) 日期: 2008-04-02 22:03
Knocking the priority down to critical for the next alpha release.  This
can be readdressed once the release is made.
msg66108 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) 日期: 2008-05-02 20:27
A new patch with just an updated comment in ceval.c.
msg66344 - (view) Author: Collin Winter (collinwinter) * (Python committer) 日期: 2008-05-06 23:26
Looks good to me. Antoine, do you have commit privileges?
msg66353 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) 日期: 2008-05-07 08:10
No, I don't.
msg66379 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) 日期: 2008-05-07 22:41
Here is a last patch fixing without lines longer than 78 chars.
msg66403 - (view) Author: Barry A. Warsaw (barry) * (Python committer) 日期: 2008-05-08 04:26
r62847
msg66793 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) 日期: 2008-05-13 19:06
This bug should be reopened, the patch does not fix it when the except
clause does not assign the exception to a local variable (that is,
"except KeyError" rather than "except KeyError as e").
Another can of worms also appeared in #2833...
msg67291 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) 日期: 2008-05-24 11:04
This is a complementary patch that should fix the remaining cases
(funnily doctest was relying on the old behaviour).
Unfortunately #2833 still remains, and would probably need some
discussion on the ML for proper resolution.
msg67293 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) 日期: 2008-05-24 12:27
For time being, should r62847 be reverted?
msg67296 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) 日期: 2008-05-24 12:53
I don't think so. As Amaury pointed in #2833, the original re-raising
behaviour which got changed by fixing the present bug was rather broken
in its own way.
Anyway, I think the question better be asked on the ML because any
solution for the re-raising behaviour will require some significant
trickery in the compiler and the eval loop.
msg67301 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) 日期: 2008-05-24 14:01
Patch removed, there are still some unsolved cases :-)
msg67311 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) 日期: 2008-05-24 22:35
Here is a hopefully complete patch using the same approach as before.

However I'm now convinced that another approach would be better in order
to solve both this bug and the various re-raising issues. It would
involve replacing most of the set_exc_info() / reset_exc_info()
mechanism in ceval.c with something different, probably based on
saving/restoring exception state values onto/from the frame stack.
Problem is, I'm not sure I'll have time for it very soon.
msg67599 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) 日期: 2008-06-01 20:05
A clean solution is now proposed in #3021.
msg67990 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) 日期: 2008-06-11 16:04
Solved by r64121.
历史
日期 用户 动作 参数
2022-04-11 14:56:32admin修改github: 46759
2008-06-11 16:04:10benjamin.peterson修改状态: open -> closed
resolution: fixed
消息: + msg67990
2008-06-01 21:33:06benjamin.peterson修改后续: Lexical exception handlers
2008-06-01 20:05:05pitrou修改消息: + msg67599
2008-05-30 20:33:14Rhamphoryncus修改抄送: + Rhamphoryncus
2008-05-24 22:35:29pitrou修改文件: + better_exc_cleanup.patch
消息: + msg67311
2008-05-24 14:01:45pitrou修改消息: + msg67301
2008-05-24 14:00:17pitrou修改文件: - better_exc_cleanup.patch
2008-05-24 12:53:13pitrou修改消息: + msg67296
2008-05-24 12:27:08benjamin.peterson修改抄送: + benjamin.peterson
消息: + msg67293
2008-05-24 11:04:26pitrou修改文件: + better_exc_cleanup.patch
消息: + msg67291
2008-05-13 19:18:16collinwinter修改状态: closed -> open
assignee: collinwinter ->
resolution: fixed -> (no value)
2008-05-13 19:06:17pitrou修改消息: + msg66793
2008-05-08 04:26:58barry修改状态: open -> closed
resolution: fixed
消息: + msg66403
优先级: release blocker -> critical
2008-05-07 22:41:25pitrou修改文件: + exc_cleanup4.patch
消息: + msg66379
2008-05-07 08:11:05pitrou修改消息: + msg66353
2008-05-06 23:26:07collinwinter修改消息: + msg66344
2008-05-03 07:07:30georg.brandl修改优先级: critical -> release blocker
2008-05-02 20:27:37pitrou修改文件: + exc_cleanup3.patch
消息: + msg66108
2008-04-02 22:03:56barry修改优先级: release blocker -> critical
抄送: + barry
消息: + msg64883
2008-03-29 23:23:46pitrou修改文件: + exc_cleanup2.patch
消息: + msg64736
2008-03-29 22:50:56jyasskin修改assignee: collinwinter
消息: + msg64734
抄送: + collinwinter
2008-03-29 18:12:09christian.heimes修改优先级: release blocker
2008-03-29 14:35:21pitrou修改文件: + exc_cleanup.patch
keywords: + patch
消息: + msg64698
2008-03-29 14:28:37pitrou创建