This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients miss-islington, ned.deily, ronaldoussoren, serhiy.storchaka, terry.reedy, wordtech
Date 2020-12-02.17:13:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
The new tk/tkinter bug in the macOS11 U2 build, other than those reported in #42507 and #42541, is that pressing F5 causes the corresponding pseudoevent handler, run_module_event, to be called twice.  (Its code is above.)  The interval between calls is about 1 millesecond -- .7 to 1.1 in 5 tries.  See this by adding the following at the top of the function's and subtracting after running code with or without syntax  error.
  print('run', time.perf_counter())

Adding multiple prints in _run_module_event shows the following for code that compiles.  With the 200 millesecond cocoa delay, the two calls run interleaved closely interleaved.  I don't understand the details, but the result is the scrambled and incorrect output given above.  With no delay as with PR 23577, the first call calls restart_subprocess in _run_module_event.  Then call 2 gets to the top of this function, then call 1 appears to finish, and call 2 is somehow aborted.

With a syntax error, the 2nd call, redisplaying the error, is not aborted.

F5 resulting in two calls is not unique, even though I have not yet seen overt double call effects.  In Shell, Control-F6 restarts.  A print in its event handler shows that it is called twice even though there is only 1 restart.

A possible kludge workaround would be to call perf_counter when the class is created and for Cocoa, each run_module call.  Return when new-old < 2milliseconds.  But the double call should be fixed as it could show up elsewhere.
Date User Action Args
2020-12-02 17:13:17terry.reedysetrecipients: + terry.reedy, ronaldoussoren, wordtech, ned.deily, serhiy.storchaka, miss-islington
2020-12-02 17:13:17terry.reedysetmessageid: <>
2020-12-02 17:13:17terry.reedylinkissue42508 messages
2020-12-02 17:13:16terry.reedycreate