New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IDLE on OS X with Cocoa Tk 8.5 can hang waiting on input / raw_input #55297
Comments
As reported by Alex McNerney in bpo-11075 msg127687: "... running Python 2.7.1:88286 (maintenance) [built from source] on ActiveState Tcl/Tk 8.5.9 causes the idle to hang when a simple script like: I can reproduce the problem using input with Cocoa Tk 8.5 and Python 3.2rc2 or raw_input with Python 2.7.1+. It does not seem to happen with Carbon Tk 8.4. This may be related to bpo-10940. Investigating further for impact on 3.2. |
This does seem to be gone in 3.2 with a up-to-date Tk 8.5 from ActiveState. |
I can still reproduce it in 3.2 with A/S Tk 8.5. The script needs to be run from a separate editor window, not the PyShell window. |
On 15 Mar, 2011, at 13:57, Ned Deily wrote:
That's odd. What I did:
x = input('prompt: ')
print(x)
All of this using an activestate Tcl/Tk that I downloaded earlier today. |
Sorry, forgot one crucial step: you have to use the keyboard accelerator (F5) to run the script, not the mouse and the menu. It seems like a number of the problems out there with Cocoa Tk 8.5 have to do with using the keyboard accelerators. |
This isn't strictly a key-bindings problem, other events also cause problems. I've patched ScriptBinding.py and repacled run_module_event that causes the original, now renamed, method to be called a little why later. This change doesn't fix the issue but makes it even worse: even the menu no longer works. def run_module_event(self, event):
self.editwin.text_frame.after('idle', self._run_module_event, None)
return 'break'
def _run_module_event(self, event):
"""Run the module after setting up the environment. I'm getting more and more disappointed in the way Tk on OSX is moving forward. |
Got it to work by introducing both a delayed call and a generated event, just one of those isn't good enough. The attached patch seems to fix the issue for me (patch was created using diff(1), not through mercurial). I haven't tested this on anything else than IDLE 3.2 on OSX 10.6 with Tk 8.5.9 from ActiveState. If this gets committed I'd at the very least use this workaround only for Tk-Cocoa on OSX, and use the current code path on other platforms. That gives more code, but makes it clear than something special is being done for one specific platform. |
Added an updated version of the patch:
The latter bullet indicates that this is probably not a reliable fix, |
The same fix also works with 2.7. The attached patch is basically the same patch, but the special casing for OSX is impacts other platforms even less than before. |
I don't have any better suggestions at the moment so let's go with it. Perhaps we'll get more insight to the root cause later. |
New changeset 1c6823317a06 by Ronald Oussoren in branch '3.2': |
New changeset 85aa02bc674c by Ronald Oussoren in branch 'default': |
New changeset 578020fe2875 by Ronald Oussoren in branch '2.7': |
I don't really like this patch, but like crashes that cause data loss even less... |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: