[New-bugs-announce] [issue39581] Python Interpreter Doesn't Work Well In Thread Class
임수진학부생
report at bugs.python.org
Sat Feb 8 04:55:36 EST 2020
New submission from 임수진학부생 <21600590 at handong.edu>:
================================================================
import threading
import time
def threadFunc():
while True:
print('new thread')
time.sleep(2)
def main():
th = threading.Thread(target=threadFunc())
th.start()
while True:
print('main Thread')
time.sleep(1)
th.join()
if __name__ == '__main__':
main()
==============================================================
When I run the above code in python 3.7, it works in unexpected way.
I expected this code causes an syntax error for giving an improper argument to parameter because I gave "threaFunc()" not "threaFun" as an argument of target in Thread class. However, this code executes a function "threadFunc()" as a general function not thread.
----------
components: Windows
messages: 361622
nosy: paul.moore, steve.dower, tim.golden, zach.ware, 임수진학부생
priority: normal
severity: normal
status: open
title: Python Interpreter Doesn't Work Well In Thread Class
type: behavior
versions: Python 3.7
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39581>
_______________________________________
More information about the New-bugs-announce
mailing list