summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_threading.py
Commit message (Collapse)AuthorAgeFilesLines
* bpo-18049: Sync thread stack size to main thread size on macOS (GH-14748)Miss Islington (bot)2019-08-011-2/+0
| | | | | | | | | This changeset increases the default size of the stack for threads on macOS to the size of the stack of the main thread and reenables the relevant recursion test. (cherry picked from commit 1a057bab0f18d6ad843ce321d1d77a4819497ae4) Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
* [3.8] bpo-36402: Fix threading._shutdown() race condition (GH-13948) (GH-14050)Victor Stinner2019-06-131-3/+76
| | | | | | | | | | | | | | | | | | | | | | | * bpo-36402: Fix threading._shutdown() race condition (GH-13948) Fix a race condition at Python shutdown when waiting for threads. Wait until the Python thread state of all non-daemon threads get deleted (join all non-daemon threads), rather than just wait until Python threads complete. * Add threading._shutdown_locks: set of Thread._tstate_lock locks of non-daemon threads used by _shutdown() to wait until all Python thread states get deleted. See Thread._set_tstate_lock(). * Add also threading._shutdown_locks_lock to protect access to threading._shutdown_locks. * Add test_finalization_shutdown() test. (cherry picked from commit 468e5fec8a2f534f1685d59da3ca4fad425c38dd) * bpo-36402: Fix threading.Thread._stop() (GH-14047) Remove the _tstate_lock from _shutdown_locks, don't remove None. (cherry picked from commit 6f75c873752a16a7ad8f35855b1e29f59d048e84)
* bpo-36829: test_threading: Fix a ref cycle (GH-13752)Victor Stinner2019-06-021-1/+5
|
* bpo-1230540: Add threading.excepthook() (GH-13515)Victor Stinner2019-05-271-0/+92
| | | | | | | | | | | | | | | | | | | Add a new threading.excepthook() function which handles uncaught Thread.run() exception. It can be overridden to control how uncaught exceptions are handled. threading.ExceptHookArgs is not documented on purpose: it should not be used directly. * threading.excepthook() and threading.ExceptHookArgs. * Add _PyErr_Display(): similar to PyErr_Display(), but accept a 'file' parameter. * Add _thread._excepthook(): C implementation of the exception hook calling _PyErr_Display(). * Add _thread._ExceptHookArgs: structseq type. * Add threading._invoke_excepthook_wrapper() which handles the gory details to ensure that everything remains alive during Python shutdown. * Add unit tests.
* bpo-23395: Fix PyErr_SetInterrupt if the SIGINT signal is ignored or not ↵Matěj Cepl2019-05-231-0/+35
| | | | | handled (GH-7778) ``_thread.interrupt_main()`` now avoids setting the Python error status if the ``SIGINT`` signal is ignored or not handled by Python.
* bpo-36084: Add native thread ID (TID) to threading.Thread (GH-13463)Jake Tesler2019-05-221-0/+5
| | | | Add native thread ID (TID) to threading.Thread objects (supported platforms: Windows, FreeBSD, Linux, macOS).
* Revert "bpo-36084: Add native thread ID to threading.Thread objects ↵Victor Stinner2019-05-211-4/+0
| | | | | (GH-11993)" (GH-13458) This reverts commit 4959c33d2555b89b494c678d99be81a65ee864b0.
* bpo-36084: Add native thread ID to threading.Thread objects (GH-11993)Jake Tesler2019-05-121-0/+4
|
* bpo-22831: Use "with" to avoid possible fd leaks in tests (part 2). (GH-10929)Serhiy Storchaka2019-03-051-7/+5
|
* bpo-35283: Add deprecation warning for Thread.isAlive (GH-11454)Dong-hee Na2019-01-171-1/+2
| | | Add a deprecated warning for the threading.Thread.isAlive() method.
* bpo-31516: Skip test_main_thread_during_shutdown() with COUNT_ALLOCS builds. ↵Zackery Spytz2018-10-121-0/+1
| | | | (GH-8052)
* bpo-32593: Drop FreeBSD 9 and older support (#5232)Victor Stinner2018-01-221-2/+1
| | | Drop support of FreeBSD 9 and older.
* Replace KB unit with KiB (#4293)Victor Stinner2017-11-081-4/+4
| | | | | | | | | | | kB (*kilo* byte) unit means 1000 bytes, whereas KiB ("kibibyte") means 1024 bytes. KB was misused: replace kB or KB with KiB when appropriate. Same change for MB and GB which become MiB and GiB. Change the output of Tools/iobench/iobench.py. Round also the size of the documentation from 5.5 MB to 5 MiB.
* Fix miscellaneous typos (#4275)luzpaz2017-11-051-1/+1
|
* bpo-31516: current_thread() should not return a dummy thread at shutdown (#3673)Antoine Pitrou2017-10-021-0/+29
| | | | bpo-31516: current_thread() should not return a dummy thread at shutdown
* bpo-31234: Join timers in test_threading (#3598)Victor Stinner2017-09-151-0/+2
| | | | Call the .join() method of threading.Timer timers to prevent the "threading_cleanup() failed to cleanup 1 threads" warning.
* bpo-31234: Add test.support.wait_threads_exit() (#3578)Victor Stinner2017-09-141-6/+8
| | | | Use _thread.count() to wait until threads exit. The new context manager prevents the "dangling thread" warning.
* bpo-31234: Join threads in test_threading (#3579)Victor Stinner2017-09-141-0/+4
| | | Call thread.join() to prevent the "dangling thread" warning.
* bpo-31370: Remove support for threads-less builds (#3385)Antoine Pitrou2017-09-071-2/+2
| | | | | | * Remove Setup.config * Always define WITH_THREAD for compatibility.
* bpo-31234: test_threading: fix ref cycle (#3150)Victor Stinner2017-08-181-0/+2
| | | | test_bare_raise_in_brand_new_thread() now explicitly breaks a reference cycle to not leak a dangling thread.
* bpo-30387: Fix warning in test_threading (#1634)Victor Stinner2017-05-171-3/+5
| | | | | | | | | test_is_alive_after_fork() now joins directly the thread to avoid the following warning added by bpo-30357: Warning -- threading_cleanup() failed to cleanup 0 threads after 2 sec (count: 0, dangling: 21) Use also a different exit code to catch generic exit code 1.
* bpo-6532: Make the thread id an unsigned integer. (#781)Serhiy Storchaka2017-03-231-3/+6
| | | | | | | | | | | * bpo-6532: Make the thread id an unsigned integer. From C API side the type of results of PyThread_start_new_thread() and PyThread_get_thread_ident(), the id parameter of PyThreadState_SetAsyncExc(), and the thread_id field of PyThreadState changed from "long" to "unsigned long". * Restore a check in thread_get_ident().
* bpo-29376: Fix assertion error in threading._DummyThread.is_alive() (GH-236)Xiang Zhang2017-02-271-0/+3
|
* Issue #26941: Fix test_threading that hangs on the Android armv7 qemu emulator.Xavier de Gaye2016-12-081-1/+1
|
* Merge 3.5 (fix raise)Victor Stinner2016-08-181-0/+18
|\
| * Fix SystemError in "raise" statementVictor Stinner2016-08-181-0/+18
| | | | | | | | | | | | | | | | Issue #27558: Fix a SystemError in the implementation of "raise" statement. In a brand new thread, raise a RuntimeError since there is no active exception to reraise. Patch written by Xiang Zhang.
* | Issue #19527: Fixed tests with defined COUNT_ALLOCS.Serhiy Storchaka2016-07-031-1/+3
|\ \ | |/
| * Issue #19527: Fixed tests with defined COUNT_ALLOCS.Serhiy Storchaka2016-07-031-1/+3
| |
* | Remove more unused imports in tests.Serhiy Storchaka2016-04-241-1/+0
| |
* | Issue #23277: Remove unused imports in tests.Serhiy Storchaka2016-04-241-1/+1
| |
* | Issue #26778: Fixed "a/an/and" typos in code comment, documentation and errorSerhiy Storchaka2016-04-171-1/+1
|\ \ | |/ | | | | messages.
| * Issue #26778: Fixed "a/an/and" typos in code comment and documentation.Serhiy Storchaka2016-04-171-1/+1
| |
* | Issue #20556: Used specific assert methods in threading tests.Serhiy Storchaka2016-03-141-14/+13
|\ \ | |/
| * Issue #20556: Used specific assert methods in threading tests.Serhiy Storchaka2016-03-141-14/+13
| |
* | Issue #23883: Add missing APIs to __all__; patch by Jacek KołodziejMartin Panter2015-11-141-0/+8
|/
* Issue #19235: Add new RecursionError exception. Patch by Georg Brandl.Yury Selivanov2015-07-031-1/+1
|
* Issue #9517: Move script_helper to the support package.Berker Peksag2015-05-061-1/+1
| | | | Patch by Christie Wilson.
* Issue #23943: Fix typos. Patch by Piotr Kasprzyk.Berker Peksag2015-04-141-1/+1
|
* Issue #22423: Unhandled exception in thread no longer causes unhandledSerhiy Storchaka2014-09-211-2/+83
| | | | AttributeError when sys.stderr is None.
* Issue #20526, #19466: Revert changes of issue #19466 which introduces aVictor Stinner2014-02-131-49/+0
| | | | | regression: don't clear anymore the state of Python threads early during the Python shutdown.
* Issue #20532: Tests which use _testcapi now are marked as CPython only.Serhiy Storchaka2014-02-071-2/+4
|\
| * Issue #20532: Tests which use _testcapi now are marked as CPython only.Serhiy Storchaka2014-02-071-1/+2
| |
| * Issue #14432: Generator now clears the borrowed reference to the thread stateVictor Stinner2013-12-131-0/+43
| | | | | | | | | | | | | | Fix a crash when a generator is created in a C thread that is destroyed while the generator is still used. The issue was that a generator contains a frame, and the frame kept a reference to the Python state of the destroyed C thread. The crash occurs when a trace function is setup.
* | Issue #14432: Remove the thread state field from the frame structure. Fix aVictor Stinner2013-12-131-0/+38
| | | | | | | | | | | | | | crash when a generator is created in a C thread that is destroyed while the generator is still used. The issue was that a generator contains a frame, and the frame kept a reference to the Python state of the destroyed C thread. The crash occurs when a trace function is setup.
* | Issue #18874: Implement the PEP 454 (tracemalloc)Victor Stinner2013-11-231-2/+2
| |
* | Close #19466: Clear the frames of daemon threads earlier during the PythonVictor Stinner2013-11-121-0/+50
| | | | | | | | | | shutdown to call objects destructors. So "unclosed file" resource warnings are now corretly emitted for daemon threads.
* | Whitespace normalization.Tim Peters2013-10-091-16/+16
| |
* | Issue 19158: a rare race in BoundedSemaphore could allow .release() too often.Tim Peters2013-10-091-0/+18
|\ \ | |/
| * Issue 19158: a rare race in BoundedSemaphore could allow .release() too often.Tim Peters2013-10-091-0/+18
| |
* | Issue #18948: improve SuppressCoreFiles to include Windows crash popup ↵Antoine Pitrou2013-10-081-1/+2
| | | | | | | | | | | | suppression, and use it in more tests. Patch by Valerie Lambert and Zachary Ware.