Message349837
# 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) |
|
Date |
User |
Action |
Args |
2019-08-16 00:36:04 | anhans | set | recipients:
+ anhans, paul.moore, tim.golden, zach.ware, steve.dower |
2019-08-16 00:36:04 | anhans | set | messageid: <1565915764.5.0.613301280158.issue37871@roundup.psfhosted.org> |
2019-08-16 00:36:04 | anhans | link | issue37871 messages |
2019-08-16 00:36:04 | anhans | create | |
|