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.
Created on 2012年03月11日 17:51 by roger.serwy, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| reading_reset.patch | roger.serwy, 2012年03月11日 17:51 | review | ||
| reading_reset_rev1.patch | roger.serwy, 2013年03月31日 22:46 | review | ||
| stop_readline.patch | roger.serwy, 2013年04月01日 03:59 | review | ||
| Messages (12) | |||
|---|---|---|---|
| msg155398 - (view) | Author: Roger Serwy (roger.serwy) * (Python committer) | Date: 2012年03月11日 17:51 | |
In PyShell.py, the "readline" method enters a nested event loop for handling input. If the shell is restarted, the nested event loop remains until after the first press of "enter" causes the "enter_callback" to quit the nested event loop. The effect is that the first line of input to the prompt is ignored by the new shell. Attached is a patch against 3.3 to fix the problem. |
|||
| msg185690 - (view) | Author: Roger Serwy (roger.serwy) * (Python committer) | Date: 2013年03月31日 22:46 | |
Closing the shell window while in the nested event loop for readline fails to exit the nested event loop. I updated the title to reflect the broader problem with readline's handling of the nested event loop. The rev1 patch causes the nested event loop to exit when restarting or closing the shell. |
|||
| msg185691 - (view) | Author: Ned Deily (ned.deily) * (Python committer) | Date: 2013年03月31日 23:06 | |
With the rev1 patch (on OS X), the cursor seems to end up on the wrong line after the restart: >>> import sys >>> sys.stdin.readline() >>> ================================ RESTART ================================ >>> *Cursor left here at (*), i.e. the left margin of the next line, not on the same line as the ">>> " prompt. |
|||
| msg185692 - (view) | Author: Ned Deily (ned.deily) * (Python committer) | Date: 2013年03月31日 23:08 | |
However, the patch *does* fix the original problem that the first input after restart is skipped. |
|||
| msg185695 - (view) | Author: Roger Serwy (roger.serwy) * (Python committer) | Date: 2013年03月31日 23:34 | |
Ned, I can confirm the behavior you are seeing. I am trying to trace down why this spurious '\n' gets inserted. |
|||
| msg185705 - (view) | Author: Roger Serwy (roger.serwy) * (Python committer) | Date: 2013年04月01日 03:59 | |
I reworked the patch to fix the cursor problem. The new code, hopefully, is simpler to understand and harder to break. Essentially, all code paths that terminate the subprocess must also call stop_readline which exits that nested event loop if needed. |
|||
| msg185712 - (view) | Author: Ned Deily (ned.deily) * (Python committer) | Date: 2013年04月01日 05:01 | |
With the stop_readline patch, I'm seeing this exception upon shell restart when trying the same test as above: $ ./python -m idlelib Exception in Tkinter callback Traceback (most recent call last): File "Lib/tkinter/__init__.py", line 1475, in __call__ return self.func(*args) File "Lib/idlelib/PyShell.py", line 1225, in restart_shell self.interp.restart_subprocess(with_cwd=True) File "Lib/idlelib/PyShell.py", line 457, in restart_subprocess console.stop_readline() AttributeError: 'PyShell' object has no attribute 'stop_readline' |
|||
| msg185714 - (view) | Author: Roger Serwy (roger.serwy) * (Python committer) | Date: 2013年04月01日 05:13 | |
I just re-applied the patch to a clean 2.7 and 3.4 branch and didn't see that exception raised. Are you sure that the patch applied cleanly? |
|||
| msg185716 - (view) | Author: Ned Deily (ned.deily) * (Python committer) | Date: 2013年04月01日 05:30 | |
Ah, sorry, I mis-edited the patch when check_whitespace.py complained about a whitespace problem. The test does now work correctly, thanks. |
|||
| msg185884 - (view) | Author: Roger Serwy (roger.serwy) * (Python committer) | Date: 2013年04月03日 04:13 | |
Ned, I was reading the dev guide more closely about the meaning of the "commit review" stage. Would it be ok to place this issue into that stage with your test result? |
|||
| msg185885 - (view) | Author: Ned Deily (ned.deily) * (Python committer) | Date: 2013年04月03日 04:16 | |
Sure, or just go ahead and commit it. LGTM. |
|||
| msg185890 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2013年04月03日 05:44 | |
New changeset 097554712637 by Roger Serwy in branch '2.7': #14254: IDLE now handles readline correctly across shell restarts. http://hg.python.org/cpython/rev/097554712637 New changeset 0be85a7fc839 by Roger Serwy in branch '3.3': #14254: IDLE now handles readline correctly across shell restarts. http://hg.python.org/cpython/rev/0be85a7fc839 New changeset 4b4f142befea by Roger Serwy in branch 'default': #14254: merge with 3.3. http://hg.python.org/cpython/rev/4b4f142befea |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:27 | admin | set | github: 58462 |
| 2013年04月03日 05:45:33 | roger.serwy | set | status: open -> closed resolution: fixed stage: commit review -> resolved |
| 2013年04月03日 05:44:57 | python-dev | set | nosy:
+ python-dev messages: + msg185890 |
| 2013年04月03日 04:16:19 | ned.deily | set | messages:
+ msg185885 stage: patch review -> commit review |
| 2013年04月03日 04:13:05 | roger.serwy | set | messages: + msg185884 |
| 2013年04月01日 05:30:21 | ned.deily | set | messages: + msg185716 |
| 2013年04月01日 05:13:11 | roger.serwy | set | messages: + msg185714 |
| 2013年04月01日 05:01:18 | ned.deily | set | messages: + msg185712 |
| 2013年04月01日 03:59:49 | roger.serwy | set | files:
+ stop_readline.patch messages: + msg185705 |
| 2013年03月31日 23:34:23 | roger.serwy | set | messages: + msg185695 |
| 2013年03月31日 23:08:04 | ned.deily | set | messages: + msg185692 |
| 2013年03月31日 23:06:13 | ned.deily | set | messages: + msg185691 |
| 2013年03月31日 22:46:52 | roger.serwy | set | files:
+ reading_reset_rev1.patch title: IDLE - shell restart during readline does not reset readline -> IDLE - shell restart or closing during readline does not exit nested event loop versions: + Python 3.4, - Python 3.2 messages: + msg185690 assignee: roger.serwy stage: patch review |
| 2012年03月11日 17:51:51 | roger.serwy | set | nosy:
+ terry.reedy, ned.deily |
| 2012年03月11日 17:51:12 | roger.serwy | create | |