From bf56e7dabe33e1c933fb7eafb15e22a407cd7465 Mon Sep 17 00:00:00 2001 From: Tomas Roun Date: Sat, 26 Oct 2024 19:43:42 +0200 Subject: [PATCH] Fix Windows --- Lib/tokenize.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/tokenize.py b/Lib/tokenize.py index bbc08f43fa2b8e..87bf98b4d0c077 100644 --- a/Lib/tokenize.py +++ b/Lib/tokenize.py @@ -193,9 +193,10 @@ def add_backslash_continuation(self, start): if row_offset == 0: return + newline = '\r\n' if self.prev_line.endswith('\r\n') else '\n' line = self.prev_line.rstrip('\\\r\n') ws = ''.join(_itertools.takewhile(str.isspace, reversed(line))) - self.tokens.append(ws + "\\\n" * row_offset) + self.tokens.append(ws + f"\\{newline}" * row_offset) self.prev_col = 0 def escape_brackets(self, token):