summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_embed.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-09-20 15:51:32 (GMT)
committerGitHub <noreply@github.com>2021-09-20 15:51:32 (GMT)
commit29e431419a0c23340099a9cd8cf23ec9c7788879 (patch)
treec02c0e3f7b82b18c7a8d042f42d0f4842c25156b /Lib/test/test_embed.py
parent50c0551f97f86bbf9f659e1bbe78a14df7754cbe (diff)
downloadcpython-29e431419a0c23340099a9cd8cf23ec9c7788879.zip
cpython-29e431419a0c23340099a9cd8cf23ec9c7788879.tar.gz
cpython-29e431419a0c23340099a9cd8cf23ec9c7788879.tar.bz2
bpo-40413: test_embed tests calling Py_RunMain() multiple times (GH-28466) (GH-28471)
Calling Py_InitializeFromConfig()+Py_RunMain() multiple times must not crash. Cleanup also test_get_argc_argv(). (cherry picked from commit 5e2c32e08ed77081cabd9d51f0589f81c1572732) Co-authored-by: Victor Stinner <vstinner@python.org>
Diffstat (limited to 'Lib/test/test_embed.py')
-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 ea47004..cc59bf4 100644
--- a/Lib/test/test_embed.py
+++ b/Lib/test/test_embed.py
@@ -308,6 +308,14 @@ class EmbeddingTests(EmbeddingTestsMixin, unittest.TestCase):
self.assertEqual(out.rstrip(), "Py_RunMain(): sys.argv=['-c', 'arg2']")
self.assertEqual(err, '')
+ def test_run_main_loop(self):
+ # bpo-40413: Calling Py_InitializeFromConfig()+Py_RunMain() multiple
+ # times must not crash.
+ nloop = 5
+ out, err = self.run_embedded_interpreter("test_run_main_loop")
+ self.assertEqual(out, "Py_RunMain(): sys.argv=['-c', 'arg2']\n" * nloop)
+ self.assertEqual(err, '')
+
class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase):
maxDiff = 4096