mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +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
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue