Bug #1579370 reports a crash when accessing the thread state of a terminated thread, when releasing a generator object. In analysing the problem, I found that f_tstate doesn't have much utility: it is used in very few places, and in these places, it might be as good or better to use the *current* thread state (rather than the frame's thread state); in some (most?) of these places, the current thread should be identical to the frame's thread, anyway. So I would like to propose that the f_tstate member is removed from the frame object. For Python 2.5, for compatibility, it probably has to remain where it is, and only PyTraceBack_Here should stop using it. As a consequence, a generator .send() makes exceptions occur in the current thread, not in the thread where the generator was created. What do you think? Regards, Martin
"Martin v. Löwis"
Bug #1579370 reports a crash when accessing the thread state of a terminated thread, when releasing a generator object.
In analysing the problem, I found that f_tstate doesn't have much utility: it is used in very few places, and in these places, it might be as good or better to use the *current* thread state (rather than the frame's thread state); in some (most?) of these places, the current thread should be identical to the frame's thread, anyway.
So I would like to propose that the f_tstate member is removed from the frame object.
For Python 2.5, for compatibility, it probably has to remain where it is, and only PyTraceBack_Here should stop using it. As a consequence, a generator .send() makes exceptions occur in the current thread, not in the thread where the generator was created.
What do you think?
Without having read the code in detail, I think what you say makes a great deal of sense. Cheers, mwh -- (FREE|OPEN) BSD: Shire horse. Solid, reliable, only occasionally prone to crushing you against a wall and then only because you've told it to without knowing. -- Jim's pedigree of operating systems, asr
On 1/22/07, Michael Hudson
"Martin v. Löwis"
writes: Bug #1579370 reports a crash when accessing the thread state of a terminated thread, when releasing a generator object.
In analysing the problem, I found that f_tstate doesn't have much utility: it is used in very few places, and in these places, it might be as good or better to use the *current* thread state (rather than the frame's thread state); in some (most?) of these places, the current thread should be identical to the frame's thread, anyway.
So I would like to propose that the f_tstate member is removed from the frame object.
For Python 2.5, for compatibility, it probably has to remain where it is, and only PyTraceBack_Here should stop using it. As a consequence, a generator .send() makes exceptions occur in the current thread, not in the thread where the generator was created.
What do you think?
Without having read the code in detail, I think what you say makes a great deal of sense.
Ditto from me. -Brett
participants (3)
-
"Martin v. Löwis"
-
Brett Cannon
-
Michael Hudson