mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
bpo-34424: Handle different policy.linesep lengths correctly. (#8803)
This commit is contained in:
parent
8da5ebe11e
commit
45b2f8893c
3 changed files with 25 additions and 1 deletions
|
@ -2625,7 +2625,7 @@ def _refold_parse_tree(parse_tree, *, policy):
|
|||
want_encoding = False
|
||||
last_ew = None
|
||||
if part.syntactic_break:
|
||||
encoded_part = part.fold(policy=policy)[:-1] # strip nl
|
||||
encoded_part = part.fold(policy=policy)[:-len(policy.linesep)]
|
||||
if policy.linesep not in encoded_part:
|
||||
# It fits on a single line
|
||||
if len(encoded_part) > maxlen - len(lines[-1]):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue