mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue 23314: SuppressCrashReports now disables CRT assertions
SuppressCrashReports should be used in test subprocesses that test invalid conditions.
This commit is contained in:
parent
7caa615fb0
commit
c55a316cff
2 changed files with 45 additions and 16 deletions
|
@ -4,22 +4,24 @@
|
|||
|
||||
import sys
|
||||
import os
|
||||
from test.support import SuppressCrashReport
|
||||
|
||||
verbose = (sys.argv[1] == 'v')
|
||||
try:
|
||||
fd = int(sys.argv[2])
|
||||
|
||||
with SuppressCrashReport():
|
||||
verbose = (sys.argv[1] == 'v')
|
||||
try:
|
||||
os.write(fd, b"blat")
|
||||
except OSError:
|
||||
# Success -- could not write to fd.
|
||||
sys.exit(0)
|
||||
else:
|
||||
if verbose:
|
||||
sys.stderr.write("fd %d is open in child" % fd)
|
||||
sys.exit(1)
|
||||
fd = int(sys.argv[2])
|
||||
|
||||
except Exception:
|
||||
if verbose:
|
||||
raise
|
||||
sys.exit(1)
|
||||
try:
|
||||
os.write(fd, b"blat")
|
||||
except OSError:
|
||||
# Success -- could not write to fd.
|
||||
sys.exit(0)
|
||||
else:
|
||||
if verbose:
|
||||
sys.stderr.write("fd %d is open in child" % fd)
|
||||
sys.exit(1)
|
||||
|
||||
except Exception:
|
||||
if verbose:
|
||||
raise
|
||||
sys.exit(1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue