[issue1703448] t.join(); assert t not in threading.enumerate() fails

2008-01-21 Thread Antoine Pitrou
Antoine Pitrou added the comment: I'm not sure about the implications of Amaury's proposal, but in any case here is a patch which contains an unit test as well. (it seems to me swapping __stop() and __delete() can do no harm as there is no way for user code to be executed synchronously between

[issue1703448] t.join(); assert t not in threading.enumerate() fails

2008-01-21 Thread Georg Brandl
Georg Brandl added the comment: Guido, you wrote that code... -- assignee: rhettinger - gvanrossum nosy: +georg.brandl, gvanrossum _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1703448 _

[issue1703448] t.join(); assert t not in threading.enumerate() fails

2008-01-21 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: Hm, this is multithreading. There is still the possibility of a switch between the two calls. In this case the thread is not marked as stopped, but enumerate() does not return it. Not easy to reproduce, though. _

[issue1703448] t.join(); assert t not in threading.enumerate() fails

2008-01-21 Thread Antoine Pitrou
Antoine Pitrou added the comment: There is still the possibility of a switch between the two calls. In this case the thread is not marked as stopped, but enumerate() does not return it. But user code is unlikely to rely on this because in most cases the thread *will* be marked as stopped ;)

[issue1703448] t.join(); assert t not in threading.enumerate() fails

2008-01-21 Thread Antoine Pitrou
Antoine Pitrou added the comment: Oops, sorry Amaury, I got your remark backwards. Nevermind... _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1703448 _ ___

[issue1703448] t.join(); assert t not in threading.enumerate() fails

2008-01-21 Thread Gregory P. Smith
Gregory P. Smith added the comment: why not just do this? finally: with _active_limbo_lock: self.__stop() try: self.__delete() except: pass (i believe with works on locks? if not turn that into an acquire, try:

[issue1703448] t.join(); assert t not in threading.enumerate() fails

2008-01-21 Thread Antoine Pitrou
Antoine Pitrou added the comment: __delete() already acquires _active_limbo_lock so your proposal must be changed for the following: with _active_limbo_lock: self.__stop() try: del _active[_get_ident()] except:

[issue1703448] t.join(); assert t not in threading.enumerate() fails

2008-01-21 Thread Antoine Pitrou
Changes by Antoine Pitrou: Added file: http://bugs.python.org/file9256/thrbug2.patch _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1703448 _ ___ Python-bugs-list

[issue1703448] t.join(); assert t not in threading.enumerate() fails

2008-01-21 Thread Gregory P. Smith
Gregory P. Smith added the comment: Looks good. Fixed in r60190 (2.6). And r60191 for release25-maint (2.5.2). -- assignee: gvanrossum - gregory.p.smith keywords: +patch resolution: - fixed status: open - closed _ Tracker [EMAIL PROTECTED]

[issue1703448] t.join(); assert t not in threading.enumerate() fails

2008-01-20 Thread Antoine Pitrou
Antoine Pitrou added the comment: I can reproduce this with both SVN trunk and 2.5.1 (on an x86 Mandriva box). -- nosy: +pitrou _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1703448 _

[issue1703448] t.join(); assert t not in threading.enumerate() fails

2008-01-20 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: Also reproduced on winXP with SVN trunk. The cause seems that in threading.py, the __stop() method notifies all waiting threads, and that __delete() effectively removes the thread from the active list. I dared to swap the two calls, and it seems to solve