This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
| Author | amaury.forgeotdarc |
|---|---|
| Recipients | amaury.forgeotdarc |
| Date | 2008年06月19日.10:06:45 |
| SpamBayes Score | 0.2803072 |
| Marked as misclassified | No |
| Message-id | <1213870014.47.0.920261148604.issue3139@psf.upfronthosting.co.za> |
| In-reply-to |
| Content | |
|---|---|
I found this problem when adding "print" statements to multi-threaded code. When applying the attached diff to a py3k installation, the output on screen always contains some garbage. The following code is an extract of fileio_write (in Modules/_fileio.c), but the same behavior appears everywhere: if (!PyArg_ParseTuple(args, "s#", &ptr, &n)) return NULL; Py_BEGIN_ALLOW_THREADS errno = 0; n = write(self->fd, ptr, n); Py_END_ALLOW_THREADS io.BufferedWriter calls this function with a bytearray. In this case, the GIL is released when holding a pointer to the bytearray data. But another thread may mutate the bytearray in between, the pointer becomes stale and can lead to segfaults or funny results. |
|
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2008年06月19日 10:06:55 | amaury.forgeotdarc | set | spambayes_score: 0.280307 -> 0.2803072 recipients: + amaury.forgeotdarc |
| 2008年06月19日 10:06:54 | amaury.forgeotdarc | set | spambayes_score: 0.280307 -> 0.280307 messageid: <1213870014.47.0.920261148604.issue3139@psf.upfronthosting.co.za> |
| 2008年06月19日 10:06:53 | amaury.forgeotdarc | link | issue3139 messages |
| 2008年06月19日 10:06:52 | amaury.forgeotdarc | create | |