From: qwavies Date: Sun, 26 Jul 2026 14:28:29 +0000 (+0000) Subject: runtime(python): Fix indenting for brackets within python byte strings X-Git-Tag: v9.2.0857~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f88e7191da1a03b2e79a2ba5fbc26f4948bcca81;p=thirdparty%2Fvim.git runtime(python): Fix indenting for brackets within python byte strings Problem: s:SearchBracket()'s skip-expression matches syntax group names ending in "Comment", "Todo", or "String" to decide whether a candidate bracket is inside a string/comment and should be skipped for indentation purposes. Byte and raw-byte string literals (b"...", rb"...") are highlighted via the pythonBytes/pythonRawBytes syntax groups, which don't end in "String", so brackets inside them (e.g. b"[") were never skipped and were counted as real, unmatched brackets, producing incorrect indentation. Solution: Add "Bytes" to the indent script's existing suffix match, so pythonBytes/pythonRawBytes are recognized directly, the same way pythonString/pythonFString/pythonRawString already are. This supersedes an earlier version of this fix that renamed pythonBytes/pythonRawBytes to pythonBytesString/pythonRawBytesString in runtime/syntax/python.vim. fixes: #20812 closes: #20827 Signed-off-by: qwavies Signed-off-by: Christian Brabandt --- diff --git a/runtime/autoload/python.vim b/runtime/autoload/python.vim index cf01198d73..8723b4ebea 100644 --- a/runtime/autoload/python.vim +++ b/runtime/autoload/python.vim @@ -23,7 +23,7 @@ function s:SearchBracket(fromlnum, flags) " VIM_INDENT_TEST_TRACE_START return searchpairpos('[[({]', '', '[])}]', a:flags, \ {-> synstack('.', col('.')) - \ ->indexof({_, id -> synIDattr(id, 'name') =~ '\%(Comment\|Todo\|String\)$'}) >= 0}, + \ ->indexof({_, id -> synIDattr(id, 'name') =~ '\%(Comment\|Todo\|String\|Bytes\)$'}) >= 0}, \ [0, a:fromlnum - s:maxoff]->max(), g:python_indent.searchpair_timeout) " VIM_INDENT_TEST_TRACE_END python#s:SearchBracket endfunction diff --git a/runtime/indent/testdir/python.in b/runtime/indent/testdir/python.in index 1f7654ae93..2a2f5bab55 100644 --- a/runtime/indent/testdir/python.in +++ b/runtime/indent/testdir/python.in @@ -94,3 +94,29 @@ open_paren_at_EOL( 100, 200, 300, 400) # END_INDENT + +# START_INDENT +"[" +# +b"abc" +# +f"[" +# +r"[" +# +b"[" +# +b"[" +b"]" +# +b"(" +# +b"{" +# +b"(" b")" +# +b"{" b"}" +# +# END_INDENT + + diff --git a/runtime/indent/testdir/python.ok b/runtime/indent/testdir/python.ok index aaeb69cdf3..6e25b5e149 100644 --- a/runtime/indent/testdir/python.ok +++ b/runtime/indent/testdir/python.ok @@ -94,3 +94,29 @@ open_paren_at_EOL( 100, 200, 300, 400) # END_INDENT + +# START_INDENT +"[" +# +b"abc" +# +f"[" +# +r"[" +# +b"[" +# +b"[" +b"]" +# +b"(" +# +b"{" +# +b"(" b")" +# +b"{" b"}" +# +# END_INDENT + + diff --git a/runtime/syntax/testdir/dumps/python_strings_bytes_02.dump b/runtime/syntax/testdir/dumps/python_strings_bytes_02.dump index 86d9560e43..89894abc4e 100644 --- a/runtime/syntax/testdir/dumps/python_strings_bytes_02.dump +++ b/runtime/syntax/testdir/dumps/python_strings_bytes_02.dump @@ -17,4 +17,4 @@ |#+0#0000e05&| |R|a|w| |U|n|i|c|o|d|e| |l|i|t|e|r|a|l|s| |a|r|e| |n|o|t| |a|l@1|o|w|e|d| +0#0000000&@36 |t|e|s|t| |=| |u|r+0#e000002&|'|I|n|v|a|l|i|d| |s|t|r|i|n|g| |w|i|t|h| |\|'| |a|n|d| |\|"| |a|n|d| |\|t|'| +0#0000000&@27 |t|e|s|t| |=| |u|R+0#e000002&|"|I|n|v|a|l|i|d| |s|t|r|i|n|g| |w|i|t|h| |\|0|4|0| |a|n|d| |\|x|F@1|"| +0#0000000&@30 -@57|3@1|,|1| @9|1|2|%| +@57|3@1|,|1| @9|1@1|%| diff --git a/runtime/syntax/testdir/dumps/python_strings_bytes_03.dump b/runtime/syntax/testdir/dumps/python_strings_bytes_03.dump index b8ee777d39..3272470610 100644 --- a/runtime/syntax/testdir/dumps/python_strings_bytes_03.dump +++ b/runtime/syntax/testdir/dumps/python_strings_bytes_03.dump @@ -17,4 +17,4 @@ |a+0#e000002&|n|d| |\+0#e000e06&|u|0@1|A|1| +0#e000002&|a|n|d| |\+0#e000e06&|U|0@2|1|0|6|0|5|"+0#e000002&@2| +0#0000000&@46 @75 |#+0#0000e05&| |F|o|r|m|a|t@1|e|d| |s|t|r|i|n|g| |l|i|t|e|r|a|l|s| |(|f|-|s|t|r|i|n|g|s|)| +0#0000000&@35 -@57|4|9|,|1| @9|1|8|%| +@57|4|9|,|1| @9|1|7|%| diff --git a/runtime/syntax/testdir/dumps/python_strings_bytes_04.dump b/runtime/syntax/testdir/dumps/python_strings_bytes_04.dump index bb963d0846..af475b6c1e 100644 --- a/runtime/syntax/testdir/dumps/python_strings_bytes_04.dump +++ b/runtime/syntax/testdir/dumps/python_strings_bytes_04.dump @@ -17,4 +17,4 @@ |a+0#e000002&|n|d| |f|i|e|l|d|s| |{+0#e000e06&|1+0#e000002&|}+0#e000e06&|,+0#e000002&| |{+0#e000e06&|2+0#e000002&|}+0#e000e06&| +0#e000002&|a|n|d| |{+0#e000e06&|1+0#e000002&| +0#0000000&@48 @4|+| @69 @4|2+0#e000002&|}+0#e000e06&|"+0#e000002&@2| +0#0000000&@65 -@57|6@1|,|1| @9|2|5|%| +@57|6@1|,|1| @9|2|4|%| diff --git a/runtime/syntax/testdir/dumps/python_strings_bytes_05.dump b/runtime/syntax/testdir/dumps/python_strings_bytes_05.dump index 23afd16a44..3108e1c8f6 100644 --- a/runtime/syntax/testdir/dumps/python_strings_bytes_05.dump +++ b/runtime/syntax/testdir/dumps/python_strings_bytes_05.dump @@ -17,4 +17,4 @@ |t|e|s|t| |=| |R+0#e000002&|F|"|R|a|w| |f|-|s|t|r|i|n|g| |w|i|t|h| |l|i|t|e|r|a|l| |{@1|f|i|e|l|d|}@1| |a|n|d| |f|i|e|l|d|s| |{+0#e000e06&|f+0#0000000&|o@1|}+0#e000e06&| +0#e000002&|a|n|d| |{+0#e000e06&|b+0#0000000&|a|r|}+0#e000e06&|"+0#e000002&| +0#0000000&@1 |t|e|s|t| |=| |f+0#e000002&|r|'@2|R|a|w| |f|-|s|t|r|i|n|g| |w|i|t|h| |q|u|o|t|e|s| |'| |a|n|d| |"| +0#0000000&@30 |a+0#e000002&|n|d| |l|i|t|e|r|a|l| |\|t| |a|n|d| |\|0|4|0| |a|n|d| |\|x|F@1| +0#0000000&@42 -@57|8|2|,|1| @9|3|2|%| +@57|8|2|,|1| @9|3|0|%| diff --git a/runtime/syntax/testdir/dumps/python_strings_bytes_06.dump b/runtime/syntax/testdir/dumps/python_strings_bytes_06.dump index eb1ae0c310..8f1352e812 100644 --- a/runtime/syntax/testdir/dumps/python_strings_bytes_06.dump +++ b/runtime/syntax/testdir/dumps/python_strings_bytes_06.dump @@ -17,4 +17,4 @@ |t+0#0000000&|e|s|t| |=| |T+0#e000002&|"|T|-|s|t|r|i|n|g| |w|i|t|h| |e|s|c|a|p|e|s| |\+0#e000e06&|0|4|0| +0#e000002&|a|n|d| |\+0#e000e06&|x|F@1| +0#e000002&|a|n|d| |f|i|e|l|d|s| |{+0#e000e06&|f+0#0000000&|o@1|}+0#e000e06&| +0#e000002&|a|n|d| |{+0#e000e06&|b+0#0000000&|a|r|}+0#e000e06&|"+0#e000002&| +0#0000000&@2 |t|e|s|t| |=| |t+0#e000002&|'|T|-|s|t|r|i|n|g| |w|i|t|h| |e|s|c|a|p|e|s| |\+0#e000e06&|u|0@1|A|1| +0#e000002&|a|n|d| |\+0#e000e06&|U|0@2|1|0|6|0|5| +0#e000002&|a|n|d| |\+0#e000e06&|N|{|I|N|V|E|R|T|E|D| |E|X|C|L|A|M |A|T|I|O|N| |M|A|R|K|}| +0#e000002&|a|n|d| |f|i|e|l|d|s| |{+0#e000e06&|f+0#0000000&|o@1|}+0#e000e06&| +0#e000002&|a|n|d| |{+0#e000e06&|b+0#0000000&|a|r|}+0#e000e06&|'+0#e000002&| +0#0000000&@35 -@57|9|5|,|1| @9|3|8|%| +@57|9|5|,|1| @9|3|6|%| diff --git a/runtime/syntax/testdir/dumps/python_strings_bytes_07.dump b/runtime/syntax/testdir/dumps/python_strings_bytes_07.dump index ac44922a38..d8d600cbb9 100644 --- a/runtime/syntax/testdir/dumps/python_strings_bytes_07.dump +++ b/runtime/syntax/testdir/dumps/python_strings_bytes_07.dump @@ -17,4 +17,4 @@ |#+0#0000e05&| |R|a|w| |t|e|m|p|l|a|t|e| |s|t|r|i|n|g| |l|i|t|e|r|a|l|s| +0#0000000&@44 |t|e|s|t| |=| |t+0#e000002&|r|'|R|a|w| |t|-|s|t|r|i|n|g| |w|i|t|h| |l|i|t|e|r|a|l| |\|'| |a|n|d| |\|"| |a|n|d| |\|t| |a|n|d| |f|i|e|l|d|s| |{+0#e000e06&|f+0#0000000&|o@1|}+0#e000e06&| +0#e000002&|a|n|d| |{+0#e000e06& |b+0#0000000&|a|r|}+0#e000e06&|'+0#e000002&| +0#0000000&@69 -@57|1@1|0|,|1| @8|4|5|%| +@57|1@1|0|,|1| @8|4|2|%| diff --git a/runtime/syntax/testdir/dumps/python_strings_bytes_08.dump b/runtime/syntax/testdir/dumps/python_strings_bytes_08.dump index 34090dc857..86e14f46f4 100644 --- a/runtime/syntax/testdir/dumps/python_strings_bytes_08.dump +++ b/runtime/syntax/testdir/dumps/python_strings_bytes_08.dump @@ -17,4 +17,4 @@ |a+0#e000002&|n|d| |l|i|t|e|r|a|l| |\|u|0@1|A|1| |a|n|d| |\|U|0@2|1|0|6|0|5| +0#0000000&@41 |a+0#e000002&|n|d| |f|i|e|l|d|s| |{+0#e000e06&|1+0#e000002&|}+0#e000e06&|,+0#e000002&| |{+0#e000e06&|2+0#e000002&|}+0#e000e06&| +0#e000002&|a|n|d| |{+0#e000e06&|1+0#e000002&| +0#0000000&@48 @4|+| @69 -@57|1|2|5|,|1| @8|5|1|%| +@57|1|2|5|,|1| @8|4|8|%| diff --git a/runtime/syntax/testdir/dumps/python_strings_bytes_09.dump b/runtime/syntax/testdir/dumps/python_strings_bytes_09.dump index 56be10e7cc..2ab49cc46c 100644 --- a/runtime/syntax/testdir/dumps/python_strings_bytes_09.dump +++ b/runtime/syntax/testdir/dumps/python_strings_bytes_09.dump @@ -17,4 +17,4 @@ @4|2+0#e000002&| +0#0000000&|+| @67 @4|3+0#e000002&|}+0#e000e06&|"+0#e000002&| +0#0000000&@67 |t|e|s|t| |=| |f+0#e000002&|"|F|l|o|a|t| |i|s| |{+0#e000e06&|1+0#e000002&|.|2|3|}+0#e000e06&|"+0#e000002&| +0#0000000&@49 -@57|1|3|9|,|1| @8|5|7|%| +@57|1|3|9|,|1| @8|5|4|%| diff --git a/runtime/syntax/testdir/dumps/python_strings_bytes_10.dump b/runtime/syntax/testdir/dumps/python_strings_bytes_10.dump index 882875c9ef..fb8502c5e2 100644 --- a/runtime/syntax/testdir/dumps/python_strings_bytes_10.dump +++ b/runtime/syntax/testdir/dumps/python_strings_bytes_10.dump @@ -17,4 +17,4 @@ |t|e|s|t| |=| |f+0#e000002&|"|r|e|s|u|l|t|:| |{+0#e000e06&|v+0#0000000&|a|l|u|e|:+0#e000e06&|{|w|i|d|t|h|:|d|}|.|{|p|r|e|c|i|s|i|o|n|!|s|}@1|"+0#e000002&| +0#0000000&@25 |t|e|s|t| |=| |f+0#e000002&|"|r|e|s|u|l|t|:| |{+0#e000e06&|v+0#0000000&|a|l|u|e|:+0#e000e06&|{|o|p|t|i|o|n|s|}|{|w|i|d|t|h|}|{|g|r|o|u|p|i|n|g|}|{|p|r|e|c|i|s|i|o|n|}|{|t|y|p|e|}@1|"+0#e000002&| +0#0000000&@5 |t|e|s|t| |=| |f+0#e000002&|"|{+0#e000e06&|n+0#0000000&|u|m|b|e|r|:+0#e000e06&|#|0|x|}|"+0#e000002&| +0#0000000&@52 -@57|1|5|7|,|1| @8|6|5|%| +@57|1|5|7|,|1| @8|6|1|%| diff --git a/runtime/syntax/testdir/dumps/python_strings_bytes_11.dump b/runtime/syntax/testdir/dumps/python_strings_bytes_11.dump index 03ca4e2dd6..87592e1718 100644 --- a/runtime/syntax/testdir/dumps/python_strings_bytes_11.dump +++ b/runtime/syntax/testdir/dumps/python_strings_bytes_11.dump @@ -17,4 +17,4 @@ |t|e|s|t| |=| |f+0#e000002&|"|a|b|c| |{+0#e000e06&|a+0#0000000&|[|"+0#e000002&|x|"|]+0#0000000&|}+0#e000e06&| +0#e000002&|d|e|f|"| +0#0000000&@48 |t|e|s|t| |=| |f+0#e000002&|"|L|i|s|t| |c|o|n|t|a|i|n|s|:|\+0#e000e06&|n|{|"+0#e000002&|\+0#e000e06&|n|"+0#e000002&|.+0#0000000&|j|o|i|n|(|a|)|}+0#e000e06&|"+0#e000002&| +0#0000000&@34 |t|e|s|t| |=| |f+0#e000002&|"|T|o|d|a|y|'|s| |d|a|t|e| |i|s| |{+0#e000e06&|d+0#0000000&|a|t|e|t|i|m|e|.|n|o|w|(|)|}+0#e000e06&|"+0#e000002&| +0#0000000&@32 -@57|1|7|5|,|1| @8|7|3|%| +@57|1|7|5|,|1| @8|6|8|%| diff --git a/runtime/syntax/testdir/dumps/python_strings_bytes_12.dump b/runtime/syntax/testdir/dumps/python_strings_bytes_12.dump index 55c8de886e..c656774ec9 100644 --- a/runtime/syntax/testdir/dumps/python_strings_bytes_12.dump +++ b/runtime/syntax/testdir/dumps/python_strings_bytes_12.dump @@ -17,4 +17,4 @@ |t|e|s|t| |=| |f+0#e000002&|"|E|x|p|r|e|s@1|i|o|n| |i|s| |{+0#e000e06&|x+0#0000000&| |=@1| |1+0#e000002&|}+0#e000e06&|"+0#e000002&| +0#0000000&@42 |t|e|s|t| |=| |f+0#e000002&|"|E|x|p|r|e|s@1|i|o|n| |i|s| |{+0#e000e06&|x+0#0000000&| |!|=| |1+0#e000002&|}+0#e000e06&|"+0#e000002&| +0#0000000&@42 |t|e|s|t| |=| |f+0#e000002&|"|E|x|p|r|e|s@1|i|o|n| |i|s| |{+0#e000e06&|(+0#0000000&|x| |:|=| |1+0#e000002&|)+0#0000000&|}+0#e000e06&|"+0#e000002&| +0#0000000&@40 -@57|1|9|2|,|1| @8|8|0|%| +@57|1|9|2|,|1| @8|7|6|%| diff --git a/runtime/syntax/testdir/dumps/python_strings_bytes_13.dump b/runtime/syntax/testdir/dumps/python_strings_bytes_13.dump index 1924c9f006..748c058303 100644 --- a/runtime/syntax/testdir/dumps/python_strings_bytes_13.dump +++ b/runtime/syntax/testdir/dumps/python_strings_bytes_13.dump @@ -17,4 +17,4 @@ @75 |#+0#0000e05&| |B|y|t|e|s| +0#0000000&@67 |t|e|s|t| |=| |b+0#e000002&|'|B|y|t|e|s| |w|i|t|h| |e|s|c|a|p|e|s| |\+0#e000e06&|'| +0#e000002&|a|n|d| |\+0#e000e06&|"| +0#e000002&|a|n|d| |\+0#e000e06&|t|'+0#e000002&| +0#0000000&@29 -@57|2|1|0|,|1| @8|8|7|%| +@57|2|1|0|,|1| @8|8|2|%| diff --git a/runtime/syntax/testdir/dumps/python_strings_bytes_14.dump b/runtime/syntax/testdir/dumps/python_strings_bytes_14.dump index 882a1e9011..0652de0489 100644 --- a/runtime/syntax/testdir/dumps/python_strings_bytes_14.dump +++ b/runtime/syntax/testdir/dumps/python_strings_bytes_14.dump @@ -10,11 +10,11 @@ |t|e|s|t| |=| |B+0#e000002&|"@2|B|y|t|e|s| |w|i|t|h| |q|u|o|t|e|s| |'| |a|n|d| |"| +0#0000000&@38 |a+0#e000002&|n|d| |e|s|c|a|p|e|s| |\+0#e000e06&|t| +0#e000002&|a|n|d| |\+0#e000e06&|0|4|0| +0#e000002&|a|n|d| |\+0#e000e06&|x|F@1| +0#0000000&@42 |a+0#e000002&|n|d| |S|y|n|t|a|x|W|a|r|n|i|n|g| |\|u|0@1|A|1| |a|n|d| |\|U|0@2|1|0|6|0|5|"@2| +0#0000000&@32 +|t|e|s|t| |=| |b+0#e000002&|"|B|y|t|e|s| |w|i|t|h| |b|r|a|c|k|e|t| |[|"| +0#0000000&@44 +|t|e|s|t| |=| |b+0#e000002&|"|B|y|t|e|s| |w|i|t|h| |b|r|a|c|k|e|t| |(|"| +0#0000000&@44 +|t|e|s|t| |=| |b+0#e000002&|"|B|y|t|e|s| |w|i|t|h| |b|r|a|c|k|e|t| |{|"| +0#0000000&@44 @75 |#+0#0000e05&| |R|a|w| |b|y|t|e|s| +0#0000000&@63 |t|e|s|t| |=| |b+0#e000002&|r|'|R|a|w| |b|y|t|e|s| |w|i|t|h| |l|i|t|e|r|a|l| |\|'| |a|n|d| |\|"| |a|n|d| |\|t|'| +0#0000000&@24 |t|e|s|t| |=| |b+0#e000002&|R|"|R|a|w| |b|y|t|e|s| |w|i|t|h| |l|i|t|e|r|a|l| |\|0|4|0| |a|n|d| |\|x|F@1|"| +0#0000000&@27 -|t|e|s|t| |=| |B+0#e000002&|r|'|R|a|w| |b|y|t|e|s| |w|i|t|h| |l|i|t|e|r|a|l| |\|u|0@1|A|1| |a|n|d| |\|U|0@2|1|0|6|0|5| |a|n|d| |\|N|{|I|N|V|E|R|T|E|D| |E|X|C|L -|A|M|A|T|I|O|N| |M|A|R|K|}|'| +0#0000000&@60 -|t|e|s|t| |=| |B+0#e000002&|R|"|R|a|w| |b|y|t|e|s| |w|i|t|h| |l|i|t|e|r|a|l| |\@1| |b|a|c|k|s|l|a|s|h|e|s| |a|n|d| |l|i|t|e|r|a|l| |\| +0#0000000&@13 -@57|2@1|5|,|1| @8|9|4|%| +@57|2@1|5|,|1| @8|8|9|%| diff --git a/runtime/syntax/testdir/dumps/python_strings_bytes_15.dump b/runtime/syntax/testdir/dumps/python_strings_bytes_15.dump index 52fce247fe..92d457e219 100644 --- a/runtime/syntax/testdir/dumps/python_strings_bytes_15.dump +++ b/runtime/syntax/testdir/dumps/python_strings_bytes_15.dump @@ -1,10 +1,13 @@ -|t+0&#ffffff0|e|s|t| |=| |B+0#e000002&|R|"|R|a|w| |b|y|t|e|s| |w|i|t|h| |l|i|t|e|r|a|l| |\@1| |b|a|c|k|s|l|a|s|h|e|s| |a|n|d| |l|i|t|e|r|a|l| |\| +0#0000000&@13 +|t+0&#ffffff0|e|s|t| |=| |b+0#e000002&|R|"|R|a|w| |b|y|t|e|s| |w|i|t|h| |l|i|t|e|r|a|l| |\|0|4|0| |a|n|d| |\|x|F@1|"| +0#0000000&@27 +|t|e|s|t| |=| |B+0#e000002&|r|'|R|a|w| |b|y|t|e|s| |w|i|t|h| |l|i|t|e|r|a|l| |\|u|0@1|A|1| |a|n|d| |\|U|0@2|1|0|6|0|5| |a|n|d| |\|N|{|I|N|V|E|R|T|E|D| |E|X|C|L +|A|M|A|T|I|O|N| |M|A|R|K|}|'| +0#0000000&@60 +|t|e|s|t| |=| |B+0#e000002&|R|"|R|a|w| |b|y|t|e|s| |w|i|t|h| |l|i|t|e|r|a|l| |\@1| |b|a|c|k|s|l|a|s|h|e|s| |a|n|d| |l|i|t|e|r|a|l| |\| +0#0000000&@13 |n+0#e000002&|e|w|l|i|n|e|"| +0#0000000&@66 -|t|e|s|t| |=| |r+0#e000002&|b|'|R|a|w| |b|y|t|e|s| |w|i|t|h| |l|i|t|e|r|a|l| |\|'| |a|n|d| |\|"| |a|n|d| |\|t|'| +0#0000000&@24 +>t|e|s|t| |=| |r+0#e000002&|b|'|R|a|w| |b|y|t|e|s| |w|i|t|h| |l|i|t|e|r|a|l| |\|'| |a|n|d| |\|"| |a|n|d| |\|t|'| +0#0000000&@24 |t|e|s|t| |=| |r+0#e000002&|B|"|R|a|w| |b|y|t|e|s| |w|i|t|h| |l|i|t|e|r|a|l| |\|0|4|0| |a|n|d| |\|x|F@1|"| +0#0000000&@27 |t|e|s|t| |=| |R+0#e000002&|b|'|R|a|w| |b|y|t|e|s| |w|i|t|h| |l|i|t|e|r|a|l| |\|u|0@1|A|1| |a|n|d| |\|U|0@2|1|0|6|0|5| |a|n|d| |\|N|{|I|N|V|E|R|T|E|D| |E|X|C|L |A|M|A|T|I|O|N| |M|A|R|K|}|'| +0#0000000&@60 ->t|e|s|t| |=| |R+0#e000002&|B|"|R|a|w| |b|y|t|e|s| |w|i|t|h| |l|i|t|e|r|a|l| |\@1| |b|a|c|k|s|l|a|s|h|e|s| |a|n|d| |l|i|t|e|r|a|l| |\| +0#0000000&@13 +|t|e|s|t| |=| |R+0#e000002&|B|"|R|a|w| |b|y|t|e|s| |w|i|t|h| |l|i|t|e|r|a|l| |\@1| |b|a|c|k|s|l|a|s|h|e|s| |a|n|d| |l|i|t|e|r|a|l| |\| +0#0000000&@13 |n+0#e000002&|e|w|l|i|n|e|"| +0#0000000&@66 |t|e|s|t| |=| |b+0#e000002&|r|'@2|R|a|w| |b|y|t|e|s| |w|i|t|h| |q|u|o|t|e|s| |'| |a|n|d| |"| +0#0000000&@33 |a+0#e000002&|n|d| |l|i|t|e|r|a|l| |\|t| |a|n|d| |\|0|4|0| |a|n|d| |\|x|F@1| +0#0000000&@42 @@ -12,9 +15,6 @@ |t|e|s|t| |=| |R+0#e000002&|B|"@2|R|a|w| |b|y|t|e|s| |w|i|t|h| |q|u|o|t|e|s| |'| |a|n|d| |"| +0#0000000&@33 |a+0#e000002&|n|d| |l|i|t|e|r|a|l| |\|t| |a|n|d| |\|0|4|0| |a|n|d| |\|x|F@1| +0#0000000&@42 |a+0#e000002&|n|d| |l|i|t|e|r|a|l| |\|u|0@1|A|1| |a|n|d| |\|U|0@2|1|0|6|0|5|"@2| +0#0000000&@38 -|~+0#4040ff13&| @73 -|~| @73 -|~| @73 -|~| @73 -|~| @73 -| +0#0000000&@56|2|4|2|,|1| @8|B|o|t| +|t|e|s|t| |=| |r+0#e000002&|b|"|R|a|w| |b|y|t|e|s| |w|i|t|h| |b|r|a|c|k|e|t| |[|"| +0#0000000&@39 +|t|e|s|t| |=| |r+0#e000002&|b|"|R|a|w| |b|y|t|e|s| |w|i|t|h| |b|r|a|c|k|e|t| |(|"| +0#0000000&@39 +@57|2|4|2|,|1| @8|9|5|%| diff --git a/runtime/syntax/testdir/dumps/python_strings_bytes_16.dump b/runtime/syntax/testdir/dumps/python_strings_bytes_16.dump new file mode 100644 index 0000000000..3b8500f04c --- /dev/null +++ b/runtime/syntax/testdir/dumps/python_strings_bytes_16.dump @@ -0,0 +1,20 @@ +|t+0&#ffffff0|e|s|t| |=| |r+0#e000002&|b|"|R|a|w| |b|y|t|e|s| |w|i|t|h| |b|r|a|c|k|e|t| |(|"| +0#0000000&@39 +|t|e|s|t| |=| |r+0#e000002&|b|"|R|a|w| |b|y|t|e|s| |w|i|t|h| |b|r|a|c|k|e|t| |{|"| +0#0000000&@39 +|t|e|s|t| |=| |R+0#e000002&|b|"|R|a|w| |b|y|t|e|s| |w|i|t|h| |b|r|a|c|k|e|t| |[|"| +0#0000000&@39 +|t|e|s|t| |=| |R+0#e000002&|b|"|R|a|w| |b|y|t|e|s| |w|i|t|h| |b|r|a|c|k|e|t| |(|"| +0#0000000&@39 +|t|e|s|t| |=| |R+0#e000002&|b|"|R|a|w| |b|y|t|e|s| |w|i|t|h| |b|r|a|c|k|e|t| |{|"| +0#0000000&@39 +>t|e|s|t| |=| |b+0#e000002&|R|"|R|a|w| |b|y|t|e|s| |w|i|t|h| |b|r|a|c|k|e|t| |[|"| +0#0000000&@39 +|t|e|s|t| |=| |b+0#e000002&|R|"|R|a|w| |b|y|t|e|s| |w|i|t|h| |b|r|a|c|k|e|t| |(|"| +0#0000000&@39 +|t|e|s|t| |=| |b+0#e000002&|R|"|R|a|w| |b|y|t|e|s| |w|i|t|h| |b|r|a|c|k|e|t| |{|"| +0#0000000&@39 +@75 +@75 +@75 +|~+0#4040ff13&| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +| +0#0000000&@56|2|5|9|,|1| @8|B|o|t| diff --git a/runtime/syntax/testdir/input/python_strings_bytes.py b/runtime/syntax/testdir/input/python_strings_bytes.py index 569168637e..f8b880ef09 100644 --- a/runtime/syntax/testdir/input/python_strings_bytes.py +++ b/runtime/syntax/testdir/input/python_strings_bytes.py @@ -229,6 +229,9 @@ and SyntaxWarning \u00A1 and \U00010605''' test = B"""Bytes with quotes ' and " and escapes \t and \040 and \xFF and SyntaxWarning \u00A1 and \U00010605""" +test = b"Bytes with bracket [" +test = b"Bytes with bracket (" +test = b"Bytes with bracket {" # Raw bytes test = br'Raw bytes with literal \' and \" and \t' @@ -247,3 +250,15 @@ and literal \u00A1 and \U00010605''' test = RB"""Raw bytes with quotes ' and " and literal \t and \040 and \xFF and literal \u00A1 and \U00010605""" +test = rb"Raw bytes with bracket [" +test = rb"Raw bytes with bracket (" +test = rb"Raw bytes with bracket {" +test = Rb"Raw bytes with bracket [" +test = Rb"Raw bytes with bracket (" +test = Rb"Raw bytes with bracket {" +test = bR"Raw bytes with bracket [" +test = bR"Raw bytes with bracket (" +test = bR"Raw bytes with bracket {" + + +