New submission from Armin Rigo:
The tp_print slots, used by 'print' statements, don't release the GIL
while writing into the C-level file. This is not only a missing
opportunity, but can cause unexpected deadlocks, as shown in the
attached file.
----------
components: Interpreter Core
files: deadlock1.py
messages: 55913
nosy: arigo
severity: normal
status: open
title: tp_print slots don't release the GIL
type: behavior
__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1164>
__________________________________
import thread, os
read_fd, write_fd = os.pipe()
fread = os.fdopen(read_fd, 'rb')
fwrite = os.fdopen(write_fd, 'wb')
def writer():
print >> fwrite, range(100000)
fwrite.flush()
thread.start_new_thread(writer, ())
line = fread.readline()
assert line == str(range(100000)) + '\n'
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com