Skip to content

Commit

Permalink
[3.12] gh-106714: Fix test_capi to not write a coredump (GH-107007) (#…
Browse files Browse the repository at this point in the history
…107009)

gh-106714: Fix test_capi to not write a coredump (GH-107007)

test_capi: Fix test_no_FatalError_infinite_loop() to no longer write
a coredump, by using test.support.SuppressCrashReport.
(cherry picked from commit 4a1026d)

Co-authored-by: Victor Stinner <vstinner@python.org>
  • Loading branch information
miss-islington and vstinner committed Jul 22, 2023
1 parent 76fd98a commit 713590f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Lib/test/test_capi/test_misc.py
Expand Up @@ -85,9 +85,15 @@ def test_instancemethod(self):

@support.requires_subprocess()
def test_no_FatalError_infinite_loop(self):
run_result, _cmd_line = run_python_until_end(
'-c', 'import _testcapi; _testcapi.crash_no_current_thread()',
)
code = textwrap.dedent("""
import _testcapi
from test import support
with support.SuppressCrashReport():
_testcapi.crash_no_current_thread()
""")

run_result, _cmd_line = run_python_until_end('-c', code)
_rc, out, err = run_result
self.assertEqual(out, b'')
# This used to cause an infinite loop.
Expand Down
@@ -0,0 +1,3 @@
test_capi: Fix test_no_FatalError_infinite_loop() to no longer write a
coredump, by using test.support.SuppressCrashReport. Patch by Victor
Stinner.

0 comments on commit 713590f

Please sign in to comment.