Xiang Zhang added the comment: I write a simple example which behaviour is like Steven's example.
import os import sys import threading import ctypes import time def test(): while True: print(time.time()) _thread = threading.Thread(target=test) pid = os.fork() if pid > 0: sys.exit(0) _thread.start() Run this with py3.4 emits one print and then comes fatal error: [code]$ python3 ctypes_test.py 1460964519.9721818 [code]$ Fatal Python error: could not acquire lock for <_io.BufferedWriter name='<stdout>'> at interpreter shutdown, possibly due to daemon threads Thread 0x00007f41fdadf700 (most recent call first): File "ctypes_test.py", line 9 in test File "/usr/lib/python3.4/threading.py", line 868 in run File "/usr/lib/python3.4/threading.py", line 920 in _bootstrap_inner File "/usr/lib/python3.4/threading.py", line 888 in _bootstrap Current thread 0x00007f41ff9a9700 (most recent call first): ^C Without import ctypes, it's OK. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26793> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com