-
-
Notifications
You must be signed in to change notification settings - Fork 245
Fix newline handling in stdout and stderr #686
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
Conversation
bpython/curtsiesfrontend/repl.py
Outdated
def send_to_stdout(self, output): | ||
"""Send unicode string to Repl stdout""" | ||
if not output: return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add break the line after :
.
bpython/curtsiesfrontend/repl.py
Outdated
@@ -1157,9 +1165,16 @@ def send_to_stderr(self, error): | |||
|
|||
Must be able to handle FmtStrs because interpreter pass in | |||
tracebacks already formatted.""" | |||
if not error: return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add break the line after :
.
bpython/curtsiesfrontend/repl.py
Outdated
lines = output.split('\n') | ||
if output == len(output) * '\n': | ||
# If the string consist only of newline characters, | ||
# str.split returns one more empty strings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since at this point split
was already called, I'd feel that if all(len(line) == 0 for line in lines):
would be nicer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about if all(not line for line in lines):
?
bpython/curtsiesfrontend/repl.py
Outdated
if error == len(error) * '\n': | ||
# If the string consist only of newline characters, | ||
# str.split returns one more empty strings. | ||
lines = lines[:-1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to the other split
comment.
Fixes #658.