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.

Author anhans
Recipients anhans, paul.moore, steve.dower, tim.golden, zach.ware
Date 2019-08-16.00:36:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1565915764.5.0.613301280158.issue37871@roundup.psfhosted.org>
In-reply-to
Content
# To reproduce:
# Put this text in a file `a.py` and run `py a.py`.
# Or just run: py -c "print(('é' * 40 + '\n') * 473)"
# Scroll up for a while. One of the lines will be:
# éééééééééééééééééééé��ééééééééééééééééééé
# (You can spot this because it's slightly longer than the other lines.)
# The error is consistently on line 237, column 21 (1-indexed).

# The error reproduces on Windows but not Linux. Tested in both powershell and CMD.
# (Failed to reproduce on either a real Linux machine or on Ubuntu with WSL.)
# On Windows, the error reproduces every time consistently.

# There is no error if N = 472 or 474.
N = 473
# There is no error if W = 39 or 41.
# (I tested with console windows of varying sizes, all well over 40 characters.)
W = 40
# There is no error if ch = "e" with no accent.
# There is still an error for other unicode characters like "Ö" or "ü".
ch = "é"
# There is no error without newlines.
s = (ch * W + "\n") * N
# Assert the string itself is correct.
assert all(c in (ch, "\n") for c in s)
print(s)

# There is no error if we use N separate print statements
# instead of printing a single string with N newlines.

# Similar scripts written in Groovy, JS and Ruby have no error.
# Groovy: System.out.println(("é" * 40 + "\n") * 473)
# JS: console.log(("é".repeat(40) + "\n").repeat(473))
# Ruby: puts(("é" * 40 + "\n") * 473)
History
Date User Action Args
2019-08-16 00:36:04anhanssetrecipients: + anhans, paul.moore, tim.golden, zach.ware, steve.dower
2019-08-16 00:36:04anhanssetmessageid: <1565915764.5.0.613301280158.issue37871@roundup.psfhosted.org>
2019-08-16 00:36:04anhanslinkissue37871 messages
2019-08-16 00:36:04anhanscreate