summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2018-07-20 15:34:23 (GMT)
committerGitHub <noreply@github.com>2018-07-20 15:34:23 (GMT)
commitfb47bca9ee2d07ce96df94b4e4abafd11826eb01 (patch)
tree5adbd1b262e05b0cd62bed74254b29f42c8b05c7 /Lib
parent2c5c0a367c6ca648178072240fe0a32848636da6 (diff)
downloadcpython-fb47bca9ee2d07ce96df94b4e4abafd11826eb01.zip
cpython-fb47bca9ee2d07ce96df94b4e4abafd11826eb01.tar.gz
cpython-fb47bca9ee2d07ce96df94b4e4abafd11826eb01.tar.bz2
bpo-34008: Allow to call Py_Main() after Py_Initialize() (GH-8043)
Py_Main() can again be called after Py_Initialize(), as in Python 3.6. The new configuration is ignored, except of _PyMainInterpreterConfig.argv which is used to update sys.argv.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_embed.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_embed.py b/Lib/test/test_embed.py
index f3b6043..024c3f9 100644
--- a/Lib/test/test_embed.py
+++ b/Lib/test/test_embed.py
@@ -238,6 +238,14 @@ class EmbeddingTests(unittest.TestCase):
self.assertEqual(out, '')
self.assertEqual(err, '')
+ def test_initialize_pymain(self):
+ """
+ bpo-34008: Calling Py_Main() after Py_Initialize() must not fail.
+ """
+ out, err = self.run_embedded_interpreter("initialize_pymain")
+ self.assertEqual(out.rstrip(), "Py_Main() after Py_Initialize: sys.argv=['-c', 'arg2']")
+ self.assertEqual(err, '')
+
if __name__ == "__main__":
unittest.main()