File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change 12
12
import dis
13
13
import os
14
14
import re
15
- import tokenize
16
15
import types
17
16
import decimal
18
17
import unittest
19
18
import warnings
20
- from io import BytesIO
21
19
from test import support
22
20
from test .support .os_helper import temp_cwd
23
21
from test .support .script_helper import assert_python_failure , assert_python_ok
@@ -1862,10 +1860,11 @@ def __format__(self, format):
1862
1860
self .assertEqual (rf"{ UnchangedFormat ():\xFF} { UnchangedFormat ():\n} " , '\\ xFF \\ n' )
1863
1861
1864
1862
def test_gh139516 (self ):
1865
- # gh-139516
1866
- # The '\n' is explicit to ensure no trailing whitespace which would invalidate the test.
1867
- # Must use tokenize instead of compile so that source is parsed by line which exposes the bug.
1868
- list (tokenize .tokenize (BytesIO ('''f"{f(a=lambda: 'à'\n )}"''' .encode ()).readline ))
1863
+ with temp_cwd ():
1864
+ script = 'script.py'
1865
+ with open (script , 'wb' ) as f :
1866
+ f .write ('''def f(a): pass\n f"{f(a=lambda: 'à'\n )}"''' .encode ())
1867
+ assert_python_ok (script )
1869
1868
1870
1869
1871
1870
if __name__ == '__main__' :
You can’t perform that action at this time.
0 commit comments