Issue 18591: threading.Thread.run returning a result (original) (raw)

Issue18591

Created on 2013-07-29 20:34 by James.Lu, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
threading.py James.Lu,2013-07-29 20:34
Messages (4)
msg193899 - (view) Author: James Lu (James.Lu) * Date: 2013-07-29 20:34
I have attached a *possible* new version of threading.py that returns the value of the target.
msg193902 - (view) Author: James Lu (James.Lu) * Date: 2013-07-29 20:38
run's calling function needs to return.
msg193903 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-07-29 20:44
Hi! I'm not sure what feature exactly you're proposing here, but please follow the devguide's guidelines to submit a proper patch: http://docs.python.org/devguide/patch.html And more generally: http://docs.python.org/devguide/
msg263700 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2016-04-18 23:23
What is your use case? I think this can easily be implemented by subclassing the threading.Thread class: class MyThread(threading.Thread): def run(self): # skip try...finally to make the example shorter result = None if self._target: result = self._target(*self._args, **self._kwargs) return result We can reopen this if you can share a valid use case. Thanks for the report!
History
Date User Action Args
2022-04-11 14:57:48 admin set github: 62791
2016-04-18 23:23:49 berker.peksag set status: open -> closednosy: + berker.peksagmessages: + resolution: rejectedstage: resolved
2013-07-29 20:44:46 pitrou set nosy: + pitroumessages: +
2013-07-29 20:38:37 James.Lu set messages: +
2013-07-29 20:34:10 James.Lu create