From 3538a3107a459259fe106e1fa5c9fb8dcf8e18b5 Mon Sep 17 00:00:00 2001 From: Amaury Forgeot d'Arc Date: Mon, 15 Dec 2008 22:29:14 +0000 Subject: #3632: the "pyo" macro from gdbinit can now run when the GIL is released. Patch by haypo. --- Misc/NEWS | 3 +++ Objects/object.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/Misc/NEWS b/Misc/NEWS index 67f1bc0..9567505 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -185,6 +185,9 @@ Build C-API ----- +- Issue #3632: from the gdb debugger, the 'pyo' macro can now be called when + the GIL is released, or owned by another thread. + - Issue #4122: On Windows, fix a compilation error when using the Py_UNICODE_ISSPACE macro in an extension module. diff --git a/Objects/object.c b/Objects/object.c index 9cd34b8..c882cf2 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -331,8 +331,11 @@ void _PyObject_Dump(PyObject* op) if (op == NULL) fprintf(stderr, "NULL\n"); else { + PyGILState_STATE gil; fprintf(stderr, "object : "); + gil = PyGILState_Ensure(); (void)PyObject_Print(op, stderr, 0); + PyGILState_Release(gil); /* XXX(twouters) cast refcount to long until %zd is universally available */ fprintf(stderr, "\n" -- cgit v0.12