summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_threading.py
Commit message (Collapse)AuthorAgeFilesLines
* #1733757: the interpreter would hang on shutdown, if the function set by ↵Amaury Forgeot d'Arc2008-04-031-0/+29
| | | | | | | | | | | | sys.settrace calls threading.currentThread. The correction somewhat improves the code, but it was close. Many thanks to the "with" construct, which turns python code into C calls. I wonder if it is not better to sys.settrace(None) just after running the __main__ module and before finalization.
* Kill a race in test_threading in which the exception info in a thread finishingJeffrey Yasskin2008-03-281-2/+6
| | | | | | | up after it was joined had a traceback pointing to that thread's (deleted) target attribute, while the test was trying to check that the target was destroyed. Big thanks to Antoine Pitrou for diagnosing the race and pointing out sys.exc_clear() to kill the exception early. This fixes issue 2496.
* Speed test_threading up from 14s to .5s, and avoid a deadlock on certainJeffrey Yasskin2008-03-211-25/+28
| | | | | | | | failures. The test for enumerate-after-join is now a little less rigorous, but the bug it references says the error happened in the first couple iterations, so 100 iterations should still be enough. cProfile was useful for identifying the slow tests here.
* Followup to r61011: Also avoid the reference cycle when the Thread's targetJeffrey Yasskin2008-02-231-3/+11
| | | | raises an exception.
* Prevent classes like:Jeffrey Yasskin2008-02-231-0/+20
| | | | | | | | | | | | | | class RunSelfFunction(object): def __init__(self): self.thread = threading.Thread(target=self._run) self.thread.start() def _run(self): pass from creating a permanent cycle between the object and the thread by having the Thread delete its references to the object when it completes. As an example of the effect of this bug, paramiko.Transport inherits from Thread to avoid it.
* - Fix Issue #1703448: A joined thread could show up in theGregory P. Smith2008-01-221-0/+18
| | | | | threading.enumerate() list after the join() for a brief period until it actually exited.
* Issue #1402: PyInterpreterState_Clear() may still invoke user codeAmaury Forgeot d'Arc2007-11-291-0/+34
| | | | | | | | (in deallocation of running threads, for example), so the PyGILState_Release() function must still be functional. On the other hand, _PyGILState_Fini() only frees memory, and can be called later. Backport candidate, but only after some experts comment on it.
* Patch #1731049: make threading.py use a proper "raise" when checking ↵Collin Winter2007-06-061-1/+41
| | | | internal state, rather than assert statements (which get stripped out by -O).
* test_PyThreadState_SetAsyncExc(): This is failing on someTim Peters2006-08-111-3/+4
| | | | | | | | | | | 64-bit boxes. I have no idea what the ctypes docs mean by "integers", and blind-guessing here that it intended to mean the signed C "int" type, in which case perhaps I can repair this by feeding the thread id argument to type ctypes.c_long(). Also made the worker thread daemonic, so it doesn't hang Python shutdown if the test continues to fail.
* Followup to bug #1069160.Tim Peters2006-08-101-0/+69
| | | | | | PyThreadState_SetAsyncExc(): internal correctness changes wrt refcount safety and deadlock avoidance. Also added a basic test case (relying on ctypes) and repaired the docs.
* test_threading now skips testing alternate thread stack sizes onAndrew MacIntyre2006-08-061-2/+12
| | | | platforms that don't support changing thread stack size.
* Increase the small thread stack size to get the testAndrew MacIntyre2006-06-131-3/+3
| | | | | to pass reliably on the one buildbot that insists on more than 32kB of thread stack.
* Patch #1454481: Make thread stack size runtime tunable.Andrew MacIntyre2006-06-131-0/+16
| | | | | | | | | | Heavily revised, comprising revisions: 46640 - original trunk revision (backed out in r46655) 46647 - markup fix (backed out in r46655) 46692:46918 merged from branch aimacintyre-sf1454481 branch tested on buildbots (Windows buildbots had problems not related to these changes).
* Revert revisions:Tim Peters2006-06-041-16/+0
| | | | | | | | | | | | | | | | 46640 Patch #1454481: Make thread stack size runtime tunable. 46647 Markup fix The first is causing many buildbots to fail test runs, and there are multiple causes with seemingly no immediate prospects for repairing them. See python-dev discussion. Note that a branch can (and should) be created for resolving these problems, like svn copy svn+ssh://svn.python.org/python/trunk -r46640 svn+ssh://svn.python.org/python/branches/NEW_BRANCH followed by merging rev 46647 to the new branch.
* Patch #1454481: Make thread stack size runtime tunable.Andrew MacIntyre2006-06-041-0/+16
|
* threading._DummyThread.__init__(): document obscure new code.Tim Peters2005-01-081-1/+22
| | | | | | | | test_threading.test_foreign_thread(): new test does a basic check that "foreign" threads can using the threading module, and that they create a _DummyThread instance in at least one use case. This isn't a very good test, since a thread created by thread.start_new_thread() isn't particularly "foreign".
* Converted to a unittest. Added checks that the bounded semaphore actuallyTim Peters2005-01-081-37/+73
| | | | does what it's supposed to do.
* Get rid of relative imports in all unittests. Now anything thatBarry Warsaw2002-07-231-1/+1
| | | | | | | | | | | imports e.g. test_support must do so using an absolute package name such as "import test.test_support" or "from test import test_support". This also updates the README in Lib/test, and gets rid of the duplicate data dirctory in Lib/test/data (replaced by Lib/email/test/data). Now Tim and Jack can have at it. :)
* Test failed because these was no expected-output file, but always printedTim Peters2001-08-201-5/+8
| | | | | | | to stdout. Repaired by not printing at all except in verbose mode. Made the test about 6x faster -- envelope analysis showed it took time proportional to the square of the # of tasks. Now it's linear.
* add a few test cases for threading module.Skip Montanaro2001-08-201-0/+52