Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment:
The problem is not only about concurrent prints.
It is about invalid pointer passed to a C function.
Here is an example that reliably crashes the interpreter on my windows
machine:
import bz2, threading
bz2c = bz2.BZ2Compressor()
b = bytearray(b"a" * 1000000)
def f():
for x in range(10):
b[:] = b""
b[:] = bytearray(b"a" * 1000000)
threading.Thread(target=f).start()
for x in range(10):
bz2c.compress(b)
bz2c.compress is a slow function, that happens to accept bytearray and
to release the GIL. If the other thread reallocates the bytearray,
bz2c.compress will read invalid data.
_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3139>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com