[PATCH] Fix Python3.9 related runtime problems

Kevin Buettner kevinb@redhat.com
Thu May 28 17:42:17 GMT 2020


On Thu, 28 May 2020 08:54:12 -0600
Tom Tromey <tom@tromey.com> wrote:

> Kevin>    /* Release the GIL while gdb runs.  */
> Kevin> +#if PY_VERSION_HEX < 0x03090000
> Kevin>    PyThreadState_Swap (NULL);
> Kevin>    PyEval_ReleaseLock ();
> Kevin> +#else
> Kevin> +  PyEval_SaveThread ();
> Kevin> +#endif  
>  
> I tend to think we could use PyEval_SaveThread in all cases.

You're right.  I tested the patch below on F28 through F32 and Rawhide
w/ Python 3.9.  No problems encountered.

I've just sent a v2 patch to the list with this change.

diff --git a/gdb/python/python.c b/gdb/python/python.c
index 049d264442..4bdd2201ab 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -1790,12 +1790,7 @@ do_start_initialization ()
     return false;
 
   /* Release the GIL while gdb runs.  */
-#if PY_VERSION_HEX < 0x03090000
-  PyThreadState_Swap (NULL);
-  PyEval_ReleaseLock ();
-#else
   PyEval_SaveThread ();
-#endif
 
   make_final_cleanup (finalize_python, NULL);



More information about the Gdb-patches mailing list