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 2008年12月17日 17:59 by eggy, last changed 2022年04月11日 14:56 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| foo.py | eggy, 2008年12月17日 17:59 | test case | ||
| threading_exit_example.py | r.david.murray, 2009年08月27日 00:59 | |||
| Messages (4) | |||
|---|---|---|---|
| msg77978 - (view) | Author: Mark Florisson (eggy) * | Date: 2008年12月17日 17:59 | |
sys.exit() exits the program when non-daemonic threads are still running, in versions >= 2.5. Test included. A demonstration here: http://paste.pocoo.org/show/95766/ (On debian GNU/Linux) |
|||
| msg91985 - (view) | Author: Joseph Malicki (jmalicki) | Date: 2009年08月26日 22:28 | |
It seems like this was introduced by the fix for Issue 1566280. Note that the threading module docs clear state: "A thread can be flagged as a "daemon thread". The significance of this flag is that the entire Python program exits when only daemon threads are left. The initial value is inherited from the creating thread. The flag can be set through the daemon property." This behavior violates it. The WaitForThreading() fix in Py_Main works only if sys.exit() is not called, which disagrees with the documentation. |
|||
| msg91991 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2009年08月27日 00:59 | |
Attached is a version of your program that calls sys.exit from a thread other than the main one. That sys.exit does not cause python to shut down. Exiting the main program by "falling off the end" does not result in Python shutdown (pass an arbitrary argument to the example program to see this). So what we have here, I believe, is a documentation problem, and I've updated the issue to reflect that. Please note in particular the last two caveats in the 'thread' docs; I don't consider these adequate documentation, but they do seem to be relevant to the issue at hand. Does this make sense to you? Note that issue 6634 should also be addressed in any update to the relevant areas of the documentation. |
|||
| msg91993 - (view) | Author: Joseph Malicki (jmalicki) | Date: 2009年08月27日 02:17 | |
Is it actually just documentation? Before Python 2.5, things worked according to the documentation, and nothing in the revisions that changed the behavior suggested this change in behavior was intentional. Moving the WaitForThreadShutdown() from Modules/main.c to Py_Finalize() would also fix this problem - I wonder why that wasn't the original change, as it more closely mirrors how Python 2.4 worked, and the documentation suggests? |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:56:42 | admin | set | github: 48934 |
| 2010年09月28日 22:14:32 | twouters | set | status: open -> closed resolution: fixed superseder: Thread shutdown exception in Thread.notify() |
| 2009年08月27日 02:17:32 | jmalicki | set | messages: + msg91993 |
| 2009年08月27日 00:59:13 | r.david.murray | set | files:
+ threading_exit_example.py priority: normal components: + Documentation, - None assignee: georg.brandl versions: + Python 3.1, Python 2.7, Python 3.2, - Python 2.5, Python 3.0 nosy: + georg.brandl, r.david.murray messages: + msg91991 stage: needs patch |
| 2009年08月26日 22:28:53 | jmalicki | set | nosy:
+ jmalicki messages: + msg91985 |
| 2008年12月17日 17:59:07 | eggy | create | |