File tree
Lib
test
Misc/NEWS.d/next/Core_and_Builtins
Original file line numberDiff line numberDiff line change@@ -1919,6 +1919,26 @@ def test_roundtrip(self):
19191919self.check_roundtrip(r"f'\\\\N{{'")
19201920self.check_roundtrip(r"f'\\\\\\N{{'")
19211921self.check_roundtrip(r"f'\\\\\\\\N{{'")
1922+1923+self.check_roundtrip(r"f'\n{{foo}}'")
1924+self.check_roundtrip(r"f'\\n{{foo}}'")
1925+self.check_roundtrip(r"f'\\\n{{foo}}'")
1926+self.check_roundtrip(r"f'\\\\n{{foo}}'")
1927+1928+self.check_roundtrip(r"f'\t{{foo}}'")
1929+self.check_roundtrip(r"f'\\t{{foo}}'")
1930+self.check_roundtrip(r"f'\\\t{{foo}}'")
1931+self.check_roundtrip(r"f'\\\\t{{foo}}'")
1932+1933+self.check_roundtrip(r"rf'\t{{foo}}'")
1934+self.check_roundtrip(r"rf'\\t{{foo}}'")
1935+self.check_roundtrip(r"rf'\\\t{{foo}}'")
1936+self.check_roundtrip(r"rf'\\\\t{{foo}}'")
1937+1938+self.check_roundtrip(r"rf'\{{foo}}'")
1939+self.check_roundtrip(r"f'\\{{foo}}'")
1940+self.check_roundtrip(r"rf'\\\{{foo}}'")
1941+self.check_roundtrip(r"f'\\\\{{foo}}'")
19221942cases= [
19231943"""
19241944if 1:
Original file line numberDiff line numberDiff line change@@ -200,7 +200,7 @@ def escape_brackets(self, token):
200200characters[-2::-1]
201201 )
202202 )
203-ifn_backslashes%2==0:
203+ifn_backslashes%2==0orcharacters[-1] !="N":
204204characters.append(character)
205205else:
206206consume_until_next_bracket=True
Original file line numberDiff line numberDiff line change@@ -0,0 +1,2 @@
1+Fix :func:`tokenize.untokenize` producing invalid syntax for
2+double braces preceded by certain escape characters.