2010/11/21 Stefan Behnel <[email protected]>: > Vitja Makarov, 21.11.2010 09:29: >> 2010/11/21 Stefan Behnel: >>> Vitja Makarov, 21.11.2010 00:02: >>>> I added patch to runthreads to check thread state at exit. >>>> >>>> http://trac.cython.org/cython_trac/attachment/ticket/596/runtests-check-threads.patch >>> >>> This isn't really related to ticket #596 (just like the fix for ticket #537 >>> wasn't). In any case, this should be done after each test, not at >>> interpreter exit time. It sounds wrong if any thread (even a deamon thread) >>> is still alive after running a test. >>> >> >> Sure that's a different issue. >> >> You've pushed check_thread_termination() it seems to me that it only >> checks, and don't help python interpreter to exit. >> So we can find this tests and disable. Or hook threading._shutdown and >> allow python quit. > > You're right, I think we need both. I pushed a fix that (I hope) handles > both cases. > > if __name__ == '__main__': try: main() except Exception: traceback.print_exc() try: check_thread_termination(ignore_seen=False) except PendingThreadsError: # normal program exit won't kill the threads, do it the hard way here os._exit(1)
check_thread_termination() should be called in both exception and normal case, so why do not place check in finally? So now it doesn't work. Why don't you want to hook it to threading._shutdown and sys.exitcall? >> Think we should open new ticket for thread issue > > The test runner hasn't really been a reason to open tickets before. When we > find bugs, we just fix them. > > >> it seems to be related to GIL, right? > > No, just to threading in general. It's not even a problem with the compiler > (i.e. what users would normally see), just with the test support. The > support for running CPython regression tests is really rudimentary. We just > compile what we find and let unittest look for anything it thinks it can > deal with. To do it right, we'd have to emulate CPython's own test runner > to make sure we ignore abstract test classes and the like. We may have to > do that at some point, now that we are getting closer and closer to the > point that most tests should "just work". But as long as it's enough to > disable a hand full of test modules, I don't feel obliged to put much > effort into this. After all, most of the tests just heavily deal with the > standard library, so they really aren't that telling w.r.t. Cython. > When I mean gil I mean that gil may be never released in cython code. -- vitja. _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
