Skip to content

Print glitch regarding newline and line-ends #744

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

Closed
BenWiederhake opened this issue Jul 19, 2018 · 1 comment
Closed

Print glitch regarding newline and line-ends #744

BenWiederhake opened this issue Jul 19, 2018 · 1 comment

Comments

@BenWiederhake
Copy link

The bug seems to be triggered when there is a print with end='' followed by a print that begins with a \n.

Minimal example:

$ bpython3
bpython version 0.17.1 on top of Python 3.6.6 /usr/bin/python3
>>> print('foo', end=''); print('\nbar')
foo

bar
>>>

Expected: foo and bar are in immediately adjacent lines.
Actual: There is an extraneous line between foo and bar.

For reference, observe what the standard python interpreter does:

$ python3
Python 3.6.6 (default, Jun 27 2018, 14:44:17) 
[GCC 8.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print('foo', end=''); print('\nbar')
foo
bar
>>> 

I have the hunch that the bug probably lives in the stdio shim of bpython. The bugtracker shows no similar bugs.

@thomasballinger
Copy link
Member

thomasballinger commented Jul 19, 2018

They way running

>>> print('asdf', end='')
asdf>>> 1

becomes

>>> print('asdf', end='')
>>> 1
asdf1

feels related to me, the way that on reformat the output gets moved to the next line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants