diff options
author | Brett Cannon <bcannon@gmail.com> | 2007-09-17 03:28:34 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2007-09-17 03:28:34 (GMT) |
commit | 0153159e67bf4247c4402a1a6e717819372c9337 (patch) | |
tree | ef58a6813bfb4011b0cd542f250f292f8cba8076 /Objects/tupleobject.c | |
parent | d36a60e1e3410450d337d4de732e127e48a6a042 (diff) | |
download | cpython-0153159e67bf4247c4402a1a6e717819372c9337.zip cpython-0153159e67bf4247c4402a1a6e717819372c9337.tar.gz cpython-0153159e67bf4247c4402a1a6e717819372c9337.tar.bz2 |
Add a bunch of GIL release/acquire points in tp_print implementations and for
PyObject_Print().
Closes issue #1164.
Diffstat (limited to 'Objects/tupleobject.c')
-rw-r--r-- | Objects/tupleobject.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c index f1e3aee..b85762a 100644 --- a/Objects/tupleobject.c +++ b/Objects/tupleobject.c @@ -188,16 +188,24 @@ static int tupleprint(PyTupleObject *op, FILE *fp, int flags) { Py_ssize_t i; + Py_BEGIN_ALLOW_THREADS fprintf(fp, "("); + Py_END_ALLOW_THREADS for (i = 0; i < Py_Size(op); i++) { - if (i > 0) + if (i > 0) { + Py_BEGIN_ALLOW_THREADS fprintf(fp, ", "); + Py_END_ALLOW_THREADS + } if (PyObject_Print(op->ob_item[i], fp, 0) != 0) return -1; } - if (Py_Size(op) == 1) + i = Py_Size(op); + Py_BEGIN_ALLOW_THREADS + if (i == 1) fprintf(fp, ","); fprintf(fp, ")"); + Py_END_ALLOW_THREADS return 0; } |