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
|
|
@ -279,14 +279,18 @@ internal_print(PyObject *op, FILE *fp, int flags, int nesting)
|
|||
#endif
|
||||
clearerr(fp); /* Clear any previous error condition */
|
||||
if (op == NULL) {
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
fprintf(fp, "<nil>");
|
||||
Py_END_ALLOW_THREADS
|
||||
}
|
||||
else {
|
||||
if (op->ob_refcnt <= 0)
|
||||
/* XXX(twouters) cast refcount to long until %zd is
|
||||
universally available */
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
fprintf(fp, "<refcnt %ld at %p>",
|
||||
(long)op->ob_refcnt, op);
|
||||
Py_END_ALLOW_THREADS
|
||||
else if (Py_Type(op)->tp_print == NULL) {
|
||||
PyObject *s;
|
||||
if (flags & Py_PRINT_RAW)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue