Title: IDLE: Colorizer and output tests hang on macOS
Type: Stage:
Components: Versions: Python 3.11, Python 3.10, Python 3.9
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: ned.deily, taleinat, terry.reedy
Priority: critical Keywords:

Created on 2021-06-07 01:41 by terry.reedy, last changed 2021-06-07 22:11 by terry.reedy.

Messages (3)
msg395239 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-06-07 01:41
Ned, have you seen or heard anything about tkinter/tk8.6.11 freezing on macOS?  It is happening in many places.

On my MacBook, python3.9 -m test -ugui -v test_idle runs OK in about 10 seconds.  With installed python3.10.0b2, it runs test_colorizer ColorCongigTest, ColorDelagatorInstantionTest, and ColorDelagatorTest.test_LoadTagDefs.  It hangs on test_case_soft_keyword, which is new in 3.10 for the new match statement soft keywords.  With added skips, it hangs on
and then test_colorizer passes.

At this point, I thought the problem was the fancy new test methods and helpers.  But running test_idle again, test_outwin.OutputWindowTest.test_goto_file_line (line 105) hangs displaying a blank window.  The test writes something at 115 which did not appear.  However, debug prints indicate that it is the 2nd write, about 121, that does not return.  The write method just inserts into the text widget.  Nothing apparently fancy.  The failure is deterministic (over 10 times).  In 3.9.5, the same test and all of test_idle ran OK 3 times.

Adding .update() and .update_idletasks() before the write did nothing.  Making this test method fail before the write, let the test continue until it hung in test_write.

The problem seems to be in the test environment.  Tests of match, case, and _ in Shell looked corrected.  Grepping idlelib for 'tkinter' returned 222 hits and multiple gotos for different files and lines within a file worked normally.
msg395285 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2021-06-07 20:38
I can reproduce test_idle hanging on all of the current macOS universal2 variants (3.8.10, 3.9.5, 3.10.0b2) which use Tk 8.6.11 but not with the legacy 10.9 variants for 3.8.10 and 3.9.5 which use Tk 8.6.8.  I've tried it on a few older systems, as far back as 10.9, and they all seem to hang the same way.  For 3.9.5 (and 3.8.10 now in security-fix mode), the first hang seems to be in test_removecolors which I need to Ctrl-C out of:

/usr/local/bin/python3.9 -m test -v -uall test_idle
test_insert (idlelib.idle_test.test_colorizer.ColorDelegatorTest) ... ok
test_notify_range (idlelib.idle_test.test_colorizer.ColorDelegatorTest) ... ok
test_recolorize (idlelib.idle_test.test_colorizer.ColorDelegatorTest) ... ok
test_recolorize_main (idlelib.idle_test.test_colorizer.ColorDelegatorTest) ... ok
test_removecolors (idlelib.idle_test.test_colorizer.ColorDelegatorTest) ...

I also see the hangs with current MacPorts Pythons linked with their build of Tk 8.6.11.
msg395290 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-06-07 22:11
Yes, I have the 'old' 3.9.5.  In IDLE, ^C does not break the hang, but Restart Shell does.  As I expected, I had to skip test_outwin's test_write and test_writelines to stop that test hanging.

Next failure: test_sidebar.LineNumbersTest ends with test_toggle_linenumbering ... OK.  That is the last test method and the hang is in tearDownClass "cls.root.update()".  Changing to .update_idletasks() fixes this.  I believe that the latter is what we usually use before destroying root.  But still, update should not crash.  At worst, a TclError.

With this fix, test_idle passes.  So do test_tcl and test_ttk_textonly.  Test_tk and test_ttk_guionly each have 1 failure.  (For me) The test suite as a whole is a mess, with multiple Python-crashed message boxes.
Date User Action Args
2021-06-07 22:11:14terry.reedysetmessages: + msg395290
2021-06-07 20:38:41ned.deilysetpriority: normal -> critical

messages: + msg395285
versions: + Python 3.9
2021-06-07 01:41:37terry.reedysettitle: IDLE: Colorizer test hangs on macOS -> IDLE: Colorizer and output tests hang on macOS
2021-06-07 01:41:11terry.reedycreate