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/setobject.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/setobject.c')
-rw-r--r-- | Objects/setobject.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Objects/setobject.c b/Objects/setobject.c index f0a11ca..025a79b 100644 --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -577,20 +577,28 @@ set_tp_print(PySetObject *so, FILE *fp, int flags) if (status != 0) { if (status < 0) return status; + Py_BEGIN_ALLOW_THREADS fprintf(fp, "%s(...)", so->ob_type->tp_name); + Py_END_ALLOW_THREADS return 0; } + Py_BEGIN_ALLOW_THREADS fprintf(fp, "%s([", so->ob_type->tp_name); + Py_END_ALLOW_THREADS while (set_next(so, &pos, &entry)) { + Py_BEGIN_ALLOW_THREADS fputs(emit, fp); + Py_END_ALLOW_THREADS emit = separator; if (PyObject_Print(entry->key, fp, 0) != 0) { Py_ReprLeave((PyObject*)so); return -1; } } + Py_BEGIN_ALLOW_THREADS fputs("])", fp); + Py_END_ALLOW_THREADS Py_ReprLeave((PyObject*)so); return 0; } |