-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
Interactive interpreter doesn't flush stderr prompty #65624
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
Comments
When I run a Python 3.3.4 prompt inside Emacs 24.3 on Windows 7, correct commands are evaluated immediately, but incorrect ones are delayed (I have to press Enter one more time), as seen below: >>> 1
1
>>> nonsense
>>>
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'nonsense' is not defined Python 2 does not do this. I've filed an Emacs bug report (http://debbugs.gnu.org/cgi/bugreport.cgi?bug=17304) and got the response to try this on the command line (where cat.exe is from an MSYS installation):
and it behaves the same way as in Emacs. |
This can be reproduced as easily under Linux: $ ./python 2>&1 | cat
Python 3.5.0a0 (default:17689e43839a+39f2a78f4357+, May 9 2014, 00:30:19)
[GCC 4.8.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 5
5
>>> 1/0
>>> nonsense
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ZeroDivisionError: division by zero
>>>
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'nonsense' is not defined
>>> |
Attached patch fixes it under Linux, and adds tests. |
The patch fixes |
New changeset ab3e012c45d0 by Antoine Pitrou in branch '3.4': New changeset d1c0cf44160c by Antoine Pitrou in branch 'default': |
Thanks for the report. This should now be fixed in 3.4 and 3.5. |
Apparently the new tests hang on the "Fedora without threads" buildbot. http://buildbot.python.org/all/builders/AMD64%20Fedora%20without%20threads%203.4/builds/123 |
Also on the PowerLinux buildbot: |
Judging by the faulthandler traceback in the PowerLinux build: Timeout (1:00:00)! ... the test is actually stuck trying to read the interactive prompt from stderr: # Drain stderr until prompt
while True:
data = stderr.read(4)
if data == b">>> ":
break
stderr.readline() <-- HERE |
New changeset ffae7aad9dfa by Antoine Pitrou in branch 'default': |
So, it seems like under Fedora (or PowerLinux), the Python interactive prompt produces different byte contents on stderr: [ 21/389] test_cmd_line_script I wonder if it's because of GNU readline? |
This looks like a well-known issue on Fedora (and Red Hat?): Apparently using XTERM=vt100 would workaround the issue. |
New changeset e57718ac8ff8 by Antoine Pitrou in branch 'default': |
According to https://bugzilla.redhat.com/show_bug.cgi?id=880393, this has actually been reported to us as bpo-19884. |
Workarounds seem to work. |
New changeset 58e2116576cf by Antoine Pitrou in branch '3.4': |
Workaround actually broke tests under shared library builds, because LD_LIBRARY_PATH isn't forwarded anymore. Will try another fix :-( |
New changeset 5a1b2566d68e by Antoine Pitrou in branch 'default': |
New changeset 974c0718c7e0 by Antoine Pitrou in branch '3.4': |
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: