Clicking the "Locals" tab just hangs when using tkinter

Here’s the repro steps:

  1. Install tkinter to the embedded Python folder.
  2. Run the Debbuger Integration - Python demo and put the following code:
from tkinter import *

ws = Tk()
ws.title('PythonGuides')
ws.geometry('300x200')
ws.config(bg='#4a7a8c')

Button(
    ws,
    text='Exit',
    command=lambda:ws.destroy()
).pack(expand=True)

ws.mainloop()

  1. Start the script.
  2. It shows the following window:
    image
  3. Click the Exit button.
  4. The debugger finishes execution.
  5. Now, set a breakpoint at 14 where “ws.mainloop()” exists.
  6. Start the script.
  7. The breakpoint is hit as expected.
  8. Now, click the “Locals” tab.
  9. The tkinter window may or may not appear. But that’s ok.
  10. The Debugger Integration demo window completely hangs.
  11. You need to kill the process by using the task manager.

I guess that the hang occurs at Alternet.Scripter.Debugger.Python.ExpressionEvaluation.DynamicMembersEvaluator.GetTypeName.ExtractTypeName(pyObject.GetAttr(ClassKey).ToString());

I looked at the PyObject.ToString() method. It uses GIL(). So, I guess it’s a deadlock. Is there a way to see if GIL has already been taken?

Hi,

I sent you proposed changes to the source code by email to check if it fixes the problem.