Issue 6064: Add "daemon" argument to threading.Thread constructor (original) (raw)

Created on 2009-05-19 19:14 by tebeka, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
threading.diff tebeka,2009-05-20 22:52 Patch review
threading.diff tebeka,2009-06-17 16:20 Diff againt r73465 review
threading.py ptn,2009-06-17 17:34
threading3k.diff tebeka,2009-06-17 17:52 Diff review
6064-multiprocessing-daemon-kwarg.patch asksol,2009-11-21 15:32 Patch for multiprocessing
threading3k.diff steven,2010-07-23 15:16 patch for threading review
multiprocessing3k.diff steven,2010-07-23 15:19 patch for multiprocessing review
Messages (21)
msg88088 - (view) Author: Miki Tebeka (tebeka) * Date: 2009-05-19 19:13
It would be nice if threading.Thread constructor will have a "daemon" argument as well. This way we'll be able to write Thread(target=some_function, daemon=1).start() Instead of currently writing t = Thread(target=some_function) t.daemon = True t.start()
msg88094 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2009-05-19 19:39
+1
msg88142 - (view) Author: Miki Tebeka (tebeka) * Date: 2009-05-20 22:52
Attaching a patch against trunk (at revision 72805).
msg88169 - (view) Author: Miki Tebeka (tebeka) * Date: 2009-05-21 21:27
I think that self.__daemonic = daemon or self._set_daemon() is wrong, need to thing about it.
msg89465 - (view) Author: Pablo Torres Navarrete (ptn) Date: 2009-06-17 15:51
+1, but I can't apply the patch cleanly: $ patch -p0 < threading.diff patching file Doc/library/threading.rst Hunk #1 succeeded at 198 (offset -17 lines). Hunk #2 succeeded at 211 (offset -17 lines). Hunk #3 succeeded at 230 (offset -17 lines). patching file Lib/threading.py Hunk #1 succeeded at 407 with fuzz 1 (offset -16 lines). Hunk #2 FAILED at 416. 1 out of 2 hunks FAILED -- saving rejects to file Lib/threading.py.rej patching file Lib/test/test_threading.py Hunk #1 succeeded at 350 with fuzz 2 (offset 14 lines).
msg89467 - (view) Author: Miki Tebeka (tebeka) * Date: 2009-06-17 16:20
I'm attaching a new diff (svn diff > threading.diff), hope this one's OK.
msg89470 - (view) Author: Pablo Torres Navarrete (ptn) Date: 2009-06-17 17:34
Nope. Our working copies seem to be different. I'm uploading mine, which I just update to revision 73468. Please diff yours against that and against HEAD too, just in case. Hunk 2 on threading.py fails because your attributes use two leading underscores and mine use only one. I have no idea why hunk4 fails.
msg89471 - (view) Author: Miki Tebeka (tebeka) * Date: 2009-06-17 17:38
I'm diffing against the 2.7 branch, I guess your comes from the 3.2? Will checkout 3.2 and do it there as well.
msg89472 - (view) Author: Miki Tebeka (tebeka) * Date: 2009-06-17 17:52
Attaching a diff against the py3k branch on revision 73468
msg89473 - (view) Author: Pablo Torres Navarrete (ptn) Date: 2009-06-17 18:12
> I'm diffing against the 2.7 branch, I guess your comes from the 3.2? *forehead meets desktop* Patch applies cleanly and all tests pass. I used it for a while and everything seemed OK. After someone else tests, I say we go for it :)
msg89474 - (view) Author: Lucas Prado Melo (conf) Date: 2009-06-17 18:12
+1 to the py3k diff. :) Hey, I think this daemon property should be set as a keyword argument of the Thread constructor.
msg89475 - (view) Author: Pablo Torres Navarrete (ptn) Date: 2009-06-17 18:23
+1 on making it a keyword-only argument.
msg89481 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-06-17 21:14
+1 from me as well.
msg89836 - (view) Author: Jesse Noller (jnoller) * (Python committer) Date: 2009-06-29 13:50
+1 to this, and I'd need to make the same patch/change to multiprocessing.Process as well
msg95585 - (view) Author: Ask Solem (asksol) (Python committer) Date: 2009-11-21 15:32
Patch for multiprocessing, adding the daemon kwarg attached.
msg111343 - (view) Author: Steven Alderson (steven) * Date: 2010-07-23 15:16
Hello, I've taken the liberty of updating the two patch files here for python3.2 at revision 83065. Apologies if I'm treading on anyones toes here. I'm taking part in a europython sprint and this is the first time I've tried this. I've modified the multiprocessing patch. The documentation didn't agree with the behaviour of the code, so I've changed the Doc file. I've also added an extra test for the default behaviour. I've reviewed the code for PEP 8 (as an exercise for me) and run the tests and they passed ok. Steven
msg111344 - (view) Author: Steven Alderson (steven) * Date: 2010-07-23 15:19
Here's the patch for multiprocessing based on python 3 revision 83065, all credit to the original author, all problems probably mine! Steven
msg111346 - (view) Author: Brian Brazil (bbrazil) * Date: 2010-07-23 15:35
I've updated the patch for 3.2 and improved the documentation formatting.
msg111347 - (view) Author: Brian Brazil (bbrazil) * Date: 2010-07-23 15:43
Looks like it lost my patch, but Steven's does the same. One tweak: in threading.rst put all of the class signature on one line or the html formatting will be a bit off.
msg129443 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-02-25 22:08
I corrected the patches (they were breaking the property of inheriting daemon by default) and committed them in r88618. Thank you!
msg129451 - (view) Author: Miki Tebeka (tebeka) * Date: 2011-02-25 22:51
Thank you! On Fri, Feb 25, 2011 at 2:08 PM, Antoine Pitrou <report@bugs.python.org> wrote: > > Antoine Pitrou <pitrou@free.fr> added the comment: > > I corrected the patches (they were breaking the property of inheriting daemon by default) and committed them in r88618. Thank you! > > ---------- > resolution:  -> fixed > stage: patch review -> committed/rejected > status: open -> closed > > _______________________________________ > Python tracker <report@bugs.python.org> > <http://bugs.python.org/issue6064> > _______________________________________ >
History
Date User Action Args
2022-04-11 14:56:49 admin set github: 50314
2011-02-25 22:51:15 tebeka set nosy:rhettinger, tebeka, pitrou, jnoller, ptn, conf, asksol, bbrazil, stevenmessages: +
2011-02-25 22:08:28 pitrou set status: open -> closednosy:rhettinger, tebeka, pitrou, jnoller, ptn, conf, asksol, bbrazil, stevenmessages: + resolution: fixedstage: patch review -> resolved
2011-01-06 17:34:22 pitrou set assignee: jnoller -> versions: + Python 3.3, - Python 2.7, Python 3.2type: behavior -> enhancementnosy:rhettinger, tebeka, pitrou, jnoller, ptn, conf, asksol, bbrazil, stevenstage: patch review
2010-07-23 15:43:09 bbrazil set messages: +
2010-07-23 15:35:49 bbrazil set nosy: + bbrazilmessages: +
2010-07-23 15:19:07 steven set files: + multiprocessing3k.diffmessages: +
2010-07-23 15:16:22 steven set files: + threading3k.diffnosy: + stevenmessages: + type: enhancement -> behavior
2009-11-21 15:32:40 asksol set files: + 6064-multiprocessing-daemon-kwarg.patchnosy: + asksolmessages: +
2009-08-06 02:14:14 jnoller set assignee: jnoller
2009-06-29 13:50:04 jnoller set nosy: + jnollermessages: +
2009-06-17 21:14:46 pitrou set nosy: + pitroumessages: +
2009-06-17 18:23:28 ptn set messages: +
2009-06-17 18:12:45 conf set nosy: + confmessages: +
2009-06-17 18:12:35 ptn set messages: +
2009-06-17 17:52:40 tebeka set files: + threading3k.diffmessages: +
2009-06-17 17:38:35 tebeka set messages: +
2009-06-17 17:34:54 ptn set files: + threading.pymessages: +
2009-06-17 16:20:39 tebeka set files: + threading.diffmessages: +
2009-06-17 15:51:14 ptn set nosy: + ptnmessages: +
2009-05-21 21:27:44 tebeka set messages: +
2009-05-20 22:52:16 tebeka set files: + threading.diffkeywords: + patchmessages: +
2009-05-20 17:38:30 amaury.forgeotdarc set keywords: + easy
2009-05-19 19:39:32 rhettinger set versions: + Python 3.2
2009-05-19 19:39:19 rhettinger set nosy: + rhettingermessages: +
2009-05-19 19:14:00 tebeka create