summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2021-05-20 10:08:05 (GMT)
committerGitHub <noreply@github.com>2021-05-20 10:08:05 (GMT)
commit58a993957abec7e47acb20376d2753051fa75452 (patch)
tree51f07a305a5706e6f4be489a5c041c5f0bc966a1 /Lib/test
parent4d396e7d79bd1152f991147718dc5f094a3cc957 (diff)
downloadcpython-58a993957abec7e47acb20376d2753051fa75452.zip
cpython-58a993957abec7e47acb20376d2753051fa75452.tar.gz
cpython-58a993957abec7e47acb20376d2753051fa75452.tar.bz2
bpo-44131: Py_FrozenMain() uses PyConfig_SetBytesArgv() (GH-26201)
Moreover, Py_FrozenMain() relies on Py_InitializeFromConfig() to handle the PYTHONUNBUFFERED environment variable and configure C stdio streams like stdout (make the stream unbuffered).
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_embed.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/Lib/test/test_embed.py b/Lib/test/test_embed.py
index c68a662..f4a18fd 100644
--- a/Lib/test/test_embed.py
+++ b/Lib/test/test_embed.py
@@ -1484,14 +1484,18 @@ class MiscTests(EmbeddingTestsMixin, unittest.TestCase):
@unittest.skipIf(os.name == 'nt',
'Py_FrozenMain is not exported on Windows')
def test_frozenmain(self):
- out, err = self.run_embedded_interpreter("test_frozenmain")
- exe = os.path.realpath('./argv0')
+ env = dict(os.environ)
+ env['PYTHONUNBUFFERED'] = '1'
+ out, err = self.run_embedded_interpreter("test_frozenmain", env=env)
+ executable = os.path.realpath('./argv0')
expected = textwrap.dedent(f"""
Frozen Hello World
sys.argv ['./argv0', '-E', 'arg1', 'arg2']
config program_name: ./argv0
- config executable: {exe}
+ config executable: {executable}
config use_environment: 1
+ config configure_c_stdio: 1
+ config buffered_stdio: 0
""").lstrip()
self.assertEqual(out, expected)