This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2011年07月10日 12:49 by newtodisworld, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (5) | |||
|---|---|---|---|
| msg140077 - (view) | Author: Amandeep Singh (newtodisworld) | Date: 2011年07月10日 12:49 | |
I created a thread, and started it and then called its run method. It raised an AttributeError exception from threading import Thread def func(): print 'abc' t = Thread(None, func) t.start() t.run() here t.run() raises an exception. |
|||
| msg140079 - (view) | Author: Eric V. Smith (eric.smith) * (Python committer) | Date: 2011年07月10日 12:58 | |
Don't call both start() and run(). From the documentation, start() arranges for run() to be called. After the call to start(), 'abc' is printed. |
|||
| msg140080 - (view) | Author: Amandeep Singh (newtodisworld) | Date: 2011年07月10日 13:13 | |
I am also not able to call run() twice. I have python 2.5.2 with me, in which I am able to call run method twice and calling run after start is working. |
|||
| msg140081 - (view) | Author: Amandeep Singh (newtodisworld) | Date: 2011年07月10日 13:18 | |
May be this is a behavior change, that a thread can not be run again. I think documentation needs to be changed in this case. |
|||
| msg140082 - (view) | Author: Georg Brandl (georg.brandl) * (Python committer) | Date: 2011年07月10日 13:22 | |
While it's not explicitly documented that run() also shouldn't be called multiple times, it does not need to be supported. Threads can be started exactly once -- this is already mentioned in the docs. Note that run() simply calls the thread target with the given args. Calling thread.run() instead is just a more confusing way of doing this. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:19 | admin | set | github: 56734 |
| 2011年07月10日 13:22:37 | georg.brandl | set | status: open -> closed nosy: + georg.brandl messages: + msg140082 |
| 2011年07月10日 13:18:38 | newtodisworld | set | messages: + msg140081 |
| 2011年07月10日 13:13:21 | newtodisworld | set | status: pending -> open messages: + msg140080 |
| 2011年07月10日 12:58:13 | eric.smith | set | status: open -> pending nosy: + eric.smith messages: + msg140079 components: + Extension Modules, - Build resolution: not a bug |
| 2011年07月10日 12:49:42 | newtodisworld | create | |