]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
#3632: the "pyo" macro from gdbinit can now run when the GIL is released.
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>
Mon, 15 Dec 2008 22:29:14 +0000 (22:29 +0000)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>
Mon, 15 Dec 2008 22:29:14 +0000 (22:29 +0000)
Patch by haypo.

Misc/NEWS
Objects/object.c

index 67f1bc04adee80da0b79e3dadbf0e633e1ed4a1d..9567505b4ba65cef7963aa995957e99dda271750 100644 (file)
--- 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.
 
index 9cd34b8d4e3b252b82c8472c5202cd36b6522ff1..c882cf25424f4129faea4cf82480b95c87a8f8a6 100644 (file)
@@ -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"