mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
Add a bunch of GIL release/acquire points in tp_print implementations and for
PyObject_Print(). Closes issue #1164.
This commit is contained in:
parent
d36a60e1e3
commit
0153159e67
13 changed files with 89 additions and 8 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue