mirror of
https://github.com/python/cpython.git
synced 2025-10-02 21:25:24 +00:00
[3.12] gh-105820: Fix tok_mode expression buffer in file & readline tokenizer (GH-105828) (#105832)
(cherry picked from commit d382ad4915
)
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
This commit is contained in:
parent
abb4eaa46f
commit
e9cf5a324e
4 changed files with 38 additions and 4 deletions
|
@ -15,7 +15,7 @@ import decimal
|
|||
import unittest
|
||||
from test import support
|
||||
from test.support.os_helper import temp_cwd
|
||||
from test.support.script_helper import assert_python_failure
|
||||
from test.support.script_helper import assert_python_failure, assert_python_ok
|
||||
|
||||
a_global = 'global variable'
|
||||
|
||||
|
@ -1635,5 +1635,18 @@ sdfsdfs{1+
|
|||
"f'{1=}{1;}'",
|
||||
])
|
||||
|
||||
def test_debug_in_file(self):
|
||||
with temp_cwd():
|
||||
script = 'script.py'
|
||||
with open('script.py', 'w') as f:
|
||||
f.write(f"""\
|
||||
print(f'''{{
|
||||
3
|
||||
=}}''')""")
|
||||
|
||||
_, stdout, _ = assert_python_ok(script)
|
||||
self.assertEqual(stdout.decode('utf-8').strip().replace('\r\n', '\n').replace('\r', '\n'),
|
||||
"3\n=3")
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue