Serhiy Storchaka
1f21eaa15e
bpo-15999: Clean up of handling boolean arguments. (GH-15610)
...
* Use the 'p' format unit instead of manually called PyObject_IsTrue().
* Pass boolean value instead 0/1 integers to functions that needs boolean.
* Convert some arguments to boolean only once.
2019-09-01 12:16:51 +03:00
Raymond Hettinger
35f6301d68
bpo-10978: Semaphores can release multiple threads at a time (GH-15588)
2019-08-29 01:45:19 -07:00
Victor Stinner
d11c2c6077
Revert "bpo-37788: Fix a reference leak if a thread is not joined (GH-15228)" (GH-15338)
...
This reverts commit d3dcc92778
.
2019-08-20 00:47:07 +01:00
Victor Stinner
d3dcc92778
bpo-37788: Fix a reference leak if a thread is not joined (GH-15228)
...
Add threading.Thread.__del__() method to ensure that the thread state
lock is removed from the _shutdown_locks list when a thread
completes.
2019-08-19 23:37:17 +01:00
Dong-hee Na
44046fe4fc
bpo-37804: Remove the deprecated method threading.Thread.isAlive() (GH-15225)
2019-08-12 19:41:08 +02:00
mbarkhau
bb110cc2ed
Improve threading.daemon docstring (GH-14278)
...
Rephrase and clarify that "the entire Python program exits when only daemon threads are left". This matches the documentation at https://docs.python.org/3/library/threading.html#thread-objects .
2019-06-22 05:51:06 -07:00
Victor Stinner
066e5b1a91
bpo-37266: Daemon threads are now denied in subinterpreters (GH-14049)
...
In a subinterpreter, spawning a daemon thread now raises an
exception. Daemon threads were never supported in subinterpreters.
Previously, the subinterpreter finalization crashed with a Pyton
fatal error if a daemon thread was still running.
* Add _thread._is_main_interpreter()
* threading.Thread.start() now raises RuntimeError if the thread is a
daemon thread and the method is called from a subinterpreter.
* The _thread module now uses Argument Clinic for the new function.
* Use textwrap.dedent() in test_threading.SubinterpThreadingTests
2019-06-14 18:55:22 +02:00
Victor Stinner
6f75c87375
tbpo-36402: Fix threading.Thread._stop() (GH-14047)
...
Remove the _tstate_lock from _shutdown_locks, don't remove None.
2019-06-13 12:06:24 +02:00
Victor Stinner
468e5fec8a
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.
2019-06-13 01:30:17 +02:00
Victor Stinner
cd590a7ced
bpo-1230540: Add threading.excepthook() (GH-13515)
...
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.
2019-05-28 00:39:52 +02:00
Jake Tesler
b121f63155
bpo-36084: Add native thread ID (TID) to threading.Thread (GH-13463)
...
Add native thread ID (TID) to threading.Thread objects
(supported platforms: Windows, FreeBSD, Linux, macOS).
2019-05-22 17:43:16 +02:00
Victor Stinner
d12e75734d
Revert "bpo-36084: Add native thread ID to threading.Thread objects (GH-11993)" (GH-13458)
...
This reverts commit 4959c33d25
.
2019-05-21 12:44:57 +02:00
Jake Tesler
4959c33d25
bpo-36084: Add native thread ID to threading.Thread objects (GH-11993)
2019-05-12 19:08:24 +02:00
Carl Bordum Hansen
62fa51f121
Fix typos and improve grammar in threading.Barrier docstrings (GH-12210)
2019-03-09 09:38:05 -08:00
Dong-hee Na
36d9e9a4d5
bpo-35283: Update the docstring of threading.Thread.join method (GH-11596)
2019-01-18 10:50:47 +01:00
Dong-hee Na
89669ffe10
bpo-35283: Add deprecation warning for Thread.isAlive (GH-11454)
...
Add a deprecated warning for the threading.Thread.isAlive() method.
2019-01-17 13:14:45 +01:00
Skip Montanaro
5634331a76
bpo-33556: Remove reference to thread module from docstring (GH-6963)
2018-05-18 13:38:36 -05:00
Antoine Pitrou
1023dbbcb7
bpo-31516: current_thread() should not return a dummy thread at shutdown ( #3673 )
...
bpo-31516: current_thread() should not return a dummy thread at shutdown
2017-10-02 16:42:15 +02:00
Antoine Pitrou
a6a4dc816d
bpo-31370: Remove support for threads-less builds ( #3385 )
...
* Remove Setup.config
* Always define WITH_THREAD for compatibility.
2017-09-07 18:56:24 +02:00
Antoine Pitrou
ee84a60858
bpo-18966: non-daemonic threads created by a multiprocessing.Process should be joined on exit ( #3111 )
...
* bpo-18966: non-daemonic threads created by a multiprocessing.Process should be joined on exit
* Add NEWS blurb
2017-08-16 20:53:28 +02:00
Gregory P. Smith
163468a766
bpo-16500: Don't use string constants for os.register_at_fork() behavior ( #1834 )
...
Instead use keyword only arguments to os.register_at_fork for each of the scenarios.
Updates the documentation for clarity.
2017-05-29 10:03:41 -07:00
Antoine Pitrou
4a8bcdf79c
bpo-16500: Use register_at_fork() in the threading module ( #1843 )
...
* bpo-16500: Use register_at_fork() in the threading module
* Update comment at top of _after_fork()
2017-05-28 14:02:26 +02:00
Antoine Pitrou
f7ecfac0c1
Doc nits for bpo-16500 ( #1841 )
...
* Doc nits for bpo-16500
* Fix more references
2017-05-28 11:35:14 +02:00
Serhiy Storchaka
aefa7ebf0f
bpo-6532: Make the thread id an unsigned integer. ( #781 )
...
* 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().
2017-03-23 14:48:39 +01:00
Xiang Zhang
f3a9faba4b
bpo-29376: Fix assertion error in threading._DummyThread.is_alive() (GH-236)
2017-02-27 11:01:30 +08:00
Martin Panter
02b75abf73
Merge spelling and grammar fixes from 3.5
2016-08-05 01:51:39 +00:00
Martin Panter
69332c1a64
Fix spelling and grammar in documentation and code comments
2016-08-04 13:07:31 +00:00
Martin Panter
3e04d5b306
Issue #27076 : Merge spelling from 3.5
2016-05-26 06:03:19 +00:00
Martin Panter
46f50726a0
Issue #27076 : Doc, comment and tests spelling fixes
...
Most fixes to Doc/ and Lib/ directories by Ville Skyttä.
2016-05-26 05:35:26 +00:00
Zachary Ware
e7041fa215
Closes #26987 : Merge with 3.5
2016-05-09 14:50:36 -05:00
Zachary Ware
78b5ed98d8
Issue #26987 : Correct implementation to match comment
...
This was inadvertently changed in 644b677c2ae5 to use self._stderr
instead of _sys.stderr.
2016-05-09 14:49:31 -05:00
Martin Panter
19e69c5a20
Issue #23883 : Add missing APIs to __all__; patch by Jacek Kołodziej
2015-11-14 12:46:42 +00:00
Benjamin Peterson
062f4cec5e
merge 3.4 ( #25362 )
2015-10-10 19:36:40 -07:00
Benjamin Peterson
414918a939
use the with statement for locking the internal condition ( closes #25362 )
...
Patch by Nir Soffer.
2015-10-10 19:34:46 -07:00
Benjamin Peterson
72181b2f53
merge 3.4 ( #25319 )
2015-10-05 22:00:33 -07:00
Benjamin Peterson
15982aad2b
reinitialize an Event's Condition with a regular lock ( closes #25319 )
2015-10-05 21:56:22 -07:00
R David Murray
f5387c0d6d
Merge: #11866 : Eliminate race condition in the computation of names for new threads.
2014-10-04 17:45:15 -04:00
R David Murray
b186f1df41
#11866 : Eliminate race condition in the computation of names for new threads.
...
Original patch by Peter Saveliev.
2014-10-04 17:43:54 -04:00
Serhiy Storchaka
c904e87c13
Issue #22423 : Unhandled exception in thread no longer causes unhandled
...
AttributeError when sys.stderr is None.
2014-09-21 22:09:20 +03:00
Serhiy Storchaka
52005c2e13
Issue #22423 : Unhandled exception in thread no longer causes unhandled
...
AttributeError when sys.stderr is None.
2014-09-21 22:08:13 +03:00
Victor Stinner
ae58649721
Issue #22043 : time.monotonic() is now always available
...
threading.Lock.acquire(), threading.RLock.acquire() and socket operations now
use a monotonic clock, instead of the system clock, when a timeout is used.
2014-09-02 23:18:25 +02:00
Antoine Pitrou
fa9211b11d
Issue #22185 : Fix an occasional RuntimeError in threading.Condition.wait() caused by mutation of the waiters queue without holding the lock.
...
Patch by Doug Zongker.
2014-08-29 23:27:33 +02:00
Antoine Pitrou
a64b92edd3
Issue #22185 : Fix an occasional RuntimeError in threading.Condition.wait() caused by mutation of the waiters queue without holding the lock.
...
Patch by Doug Zongker.
2014-08-29 23:26:36 +02:00
Raymond Hettinger
62f4dad816
Issue 21137: Better repr for threading.Lock()
2014-05-25 18:22:35 -07:00
Victor Stinner
7fa767e517
Issue #20976 : pyflakes: Remove unused imports
2014-03-20 09:16:38 +01:00
Antoine Pitrou
1095907624
Remove stray semicolon
2014-03-17 18:22:41 +01:00
Tim Peters
a577f1e0f1
Changed a comment to end grammar bikeshedding ;-)
2013-10-26 11:56:16 -05:00
Tim Peters
7bad39f174
Fiddled Thread.join() to be a little simpler. Kinda ;-)
2013-10-25 22:33:52 -05:00
Tim Peters
e5bb0bf04d
Issue #19399 : fix sporadic test_subprocess failure.
...
Change Thread.join() with a negative timeout to just return. The
behavior isn't documented then, but this restores previous
behavior.
2013-10-25 20:46:51 -05:00
Georg Brandl
bb2ed516cc
merge with 3.3
2013-10-13 10:44:04 +02:00