Issue 7680: pythonw crash while attempting to start() a thread object (original) (raw)

Created on 2010-01-12 04:22 by dontbugme, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (5)
msg97622 - (view) Author: (dontbugme) Date: 2010-01-12 04:22
PythonW.exe crash, tested under Windows 7 x86 / x64, Python v2.6.4. The crash can be reproduced by opening and running the attached code in IDLE. TY! Error Message: Microsoft Visual C++ Runtime Library Runtime Error! Program: C:\Python26\pythonw.exe This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. Code: #!/usr/bin/env python import threading class MyThread (threading.Thread): def __init__(self): threading.Thread.__init__(self) def run(self): print 'hello, dude!' t = MyThread() t.start()
msg97623 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2010-01-12 04:37
On 2.7a2 on Windows 7 it seems to work, I opened the script with IDLE and did F5, this is the output I got: Python 2.7a2 (r27a2:77402, Jan 10 2010, 10:04:50) [MSC v.1500 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>> ================================ RESTART ================================ >>> hello, dude! >>>
msg97628 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2010-01-12 10:41
pythonw.exe has an invalid stdout. Does the problem reproduce when you call print function directly, without a thread?
msg97634 - (view) Author: (dontbugme) Date: 2010-01-12 16:38
I did not understand the question. If you were meaning running a plain print(), then it does work: #!/usr/bin/env python print "foo" IDLE 2.6.4 ==== No Subprocess ==== >>> foo >>> Well, as you suggested the problem most probably originates from calling print from within a thread. This code works as it should: #!/usr/bin/env python import threading class MyThread (threading.Thread): def __init__(self): threading.Thread.__init__(self) def run(self): f = open('I am alive', 'w') f.write('hello, dude!\n') f.close() t = MyThread() t.start()
msg97986 - (view) Author: (dontbugme) Date: 2010-01-17 23:31
After asking at the IRC channel, posborne resolved the error: Also, the behaviour of exiting the main thread before all threads has exited is undefined. Is the behaviour different if you add t.join() to the end of the script? Code: #!/usr/bin/env python import threading class MyThread (threading.Thread): def __init__(self): threading.Thread.__init__(self) def run(self): print 'hello, dude!' t = MyThread() t.start() t.join()
History
Date User Action Args
2022-04-11 14:56:56 admin set github: 51929
2010-01-18 03:40:14 brian.curtin set resolution: not a bugstage: resolved
2010-01-17 23:31:54 dontbugme set status: open -> closedmessages: +
2010-01-12 16:38:59 dontbugme set messages: +
2010-01-12 10:41:37 amaury.forgeotdarc set nosy: + amaury.forgeotdarcmessages: +
2010-01-12 04:37:30 ezio.melotti set priority: normalnosy: + ezio.melottimessages: +
2010-01-12 04:22:20 dontbugme create