[Python-Dev] second opinion for proposed fix for bug #754449 (original) (raw)
Guido van Rossum guido at python.org
Wed Mar 3 10:04:02 EST 2004
- Previous message: [Python-Dev] second opinion for proposed fix for bug #754449
- Next message: [Python-Dev] second opinion for proposed fix for bug #754449
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
So http://python.org/sf/754449 is a bug report about threading and an exception being raised when the interpreter is being shut down, setting a function in threading to None because of teardown, and then trying to execute that now killed function in the shutdown code for threading.Thread (what a mouthful).
Ouch.
Basically the exception stems from a call to threading.currentThread in the Condition class (which is just Condition) which, according to the comment along with the call, is just for its side-effect. Well, I looked and I can't find the need for the side-effect. I took out the code and ran the regression tests and nothing failed because of it.
Since the code says the call is for the explicit side-effect I just wanted another pair of eyes to quickly scan the code in threading.py and either agree with me or tell me I am blind and point out where the side-effect is needed for Condition instances. The offending currentThread calls can be found on lines 196 and 238 (can also just search for "side-effect" to find them).
This is my code. It was long ago. I think the intended side effect is creating a dummy thread IF the calling thread was not created by the threading module but by thread.start_new_thread(). The current thread in turn is only relevant when the Condition's lock is an RLock. But the only thing that is ever done with that is comparing it with the outcome of another call to currentThread(). So I THINK that the side effect isn't particularly needed.
(But the threading module references other globals, so I'm not sure that ripping out the currentThread() calls is really enough, except in this particular app's case.)
--Guido van Rossum (home page: http://www.python.org/~guido/)
- Previous message: [Python-Dev] second opinion for proposed fix for bug #754449
- Next message: [Python-Dev] second opinion for proposed fix for bug #754449
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]