Issue31546
Created on 2017-09-21 16:13 by yhlam, last changed 2022-04-11 14:58 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| test_tk.py | yhlam, 2017-09-21 16:13 | TK test script | ||
| py35_call_stack.png | yhlam, 2017-09-21 16:15 | Python 3.5 call stack | ||
| py36_call_stack.png | yhlam, 2017-09-21 16:16 | Python 3.6 call stack | ||
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 7978 | merged | tcaswell, 2018-06-27 21:06 | |
| PR 7990 | merged | miss-islington, 2018-06-28 16:31 | |
| PR 7991 | merged | miss-islington, 2018-06-28 16:31 | |
| Messages (12) | |||
|---|---|---|---|
| msg302701 - (view) | Author: Lam Yuen Hei (yhlam) | Date: 2017-09-21 16:13 | |
Since python 3.6, PyOS_InputHook is not called when waiting for IO in Windows. This causes issues with GUI framework like tkinter that relys on PyOS_InputHook to handle user interaction. I attached a test script. When running the script with python 3.5, the tkinter window will show up properly. But if you run the script with python 3.6, the tkinter window will be frozen. I believe the issue is introduced in commit 3929499. In commit 3929499, _PyOS_WindowsConsoleReadline is added as the new Windows implementation of PyOS_StdioReadline. Originally, PyOS_StdioReadline calls my_fgets to read input, and my_fgets will call PyOS_InputHook before the calling the real fgets. However, _PyOS_WindowsConsoleReadline calls ReadConsoleW instead of my_fgets to read input, and PyOS_InputHook is never called. The bug is first reported in matplotlib. https://github.com/matplotlib/matplotlib/issues/9206#issuecomment-331192016 |
|||
| msg302702 - (view) | Author: Lam Yuen Hei (yhlam) | Date: 2017-09-21 16:15 | |
Attach python 3.5 call stack of the test script |
|||
| msg302703 - (view) | Author: Lam Yuen Hei (yhlam) | Date: 2017-09-21 16:16 | |
Attach python 3.6 call stack of the test script |
|||
| msg302705 - (view) | Author: Steve Dower (steve.dower) * ![]() |
Date: 2017-09-21 16:25 | |
You're right, we're missing this section of code:
if (PyOS_InputHook != NULL)
(void)(PyOS_InputHook)();
Since we just call it and ignore anything it does, it should be safe enough to add it immediately before the ReadConsoleW call (inside the loop).
|
|||
| msg302707 - (view) | Author: Steve Dower (steve.dower) * ![]() |
Date: 2017-09-21 16:26 | |
(Belongs inside Parser/myreadline.c in the _PyOS_WindowsConsoleReadline function) |
|||
| msg304785 - (view) | Author: Lam Yuen Hei (yhlam) | Date: 2017-10-23 09:22 | |
As the fix seems simple, any chance this bug can be fixed in next python 3.6 maintenance release? It is the major roadblock for my application to upgrade to python 3.6. Thanks |
|||
| msg305567 - (view) | Author: Steve Dower (steve.dower) * ![]() |
Date: 2017-11-04 21:40 | |
The fix is simple, just need someone to do a PR. (I might get to it eventually, but I'm working on other things right now.) |
|||
| msg305568 - (view) | Author: Steve Dower (steve.dower) * ![]() |
Date: 2017-11-04 21:41 | |
And yes, I think this is fine for 3.6. |
|||
| msg320674 - (view) | Author: Steve Dower (steve.dower) * ![]() |
Date: 2018-06-28 16:29 | |
New changeset 9b9d58f0d88b338eb8d2ae0da5cd91d60d1b0e39 by Steve Dower (Thomas A Caswell) in branch 'master': bpo-31546: Fix input hook integration (GH-7978) https://github.com/python/cpython/commit/9b9d58f0d88b338eb8d2ae0da5cd91d60d1b0e39 |
|||
| msg320680 - (view) | Author: miss-islington (miss-islington) | Date: 2018-06-28 17:47 | |
New changeset 0ebd1bc94a941a5044e26de946c1100d652dfe46 by Miss Islington (bot) in branch '3.6': bpo-31546: Fix input hook integration (GH-7978) https://github.com/python/cpython/commit/0ebd1bc94a941a5044e26de946c1100d652dfe46 |
|||
| msg320681 - (view) | Author: Steve Dower (steve.dower) * ![]() |
Date: 2018-06-28 17:48 | |
New changeset 9d92524c11def666a78ff57a9603a9ad6142418a by Steve Dower (Miss Islington (bot)) in branch '3.7': bpo-31546: Fix input hook integration (GH-7978) https://github.com/python/cpython/commit/9d92524c11def666a78ff57a9603a9ad6142418a |
|||
| msg348067 - (view) | Author: Zackery Spytz (ZackerySpytz) * ![]() |
Date: 2019-07-17 15:08 | |
Can this issue be closed? PR 7978 was merged and backported. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:52 | admin | set | github: 75727 |
| 2019-07-23 15:44:37 | steve.dower | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2019-07-17 15:08:52 | ZackerySpytz | set | nosy:
+ ZackerySpytz messages: + msg348067 |
| 2018-06-28 17:48:39 | steve.dower | set | messages: + msg320681 |
| 2018-06-28 17:47:56 | miss-islington | set | nosy:
+ miss-islington messages: + msg320680 |
| 2018-06-28 16:31:55 | miss-islington | set | pull_requests: + pull_request7602 |
| 2018-06-28 16:31:04 | miss-islington | set | pull_requests: + pull_request7601 |
| 2018-06-28 16:29:53 | steve.dower | set | messages: + msg320674 |
| 2018-06-27 21:06:47 | tcaswell | set | keywords:
+ patch stage: patch review pull_requests: + pull_request7589 |
| 2017-11-04 21:41:03 | steve.dower | set | messages: + msg305568 |
| 2017-11-04 21:40:52 | steve.dower | set | messages: + msg305567 |
| 2017-10-23 09:22:17 | yhlam | set | messages: + msg304785 |
| 2017-09-21 16:26:05 | steve.dower | set | messages: + msg302707 |
| 2017-09-21 16:25:35 | steve.dower | set | messages: + msg302705 |
| 2017-09-21 16:16:11 | yhlam | set | files:
+ py36_call_stack.png messages: + msg302703 |
| 2017-09-21 16:15:37 | yhlam | set | files:
+ py35_call_stack.png messages: + msg302702 |
| 2017-09-21 16:13:02 | yhlam | create | |

