mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
bpo-42005: profile and cProfile catch BrokenPipeError (GH-22643)
This commit is contained in:
parent
f1ff800db1
commit
3554fa4abe
3 changed files with 14 additions and 2 deletions
|
@ -175,7 +175,12 @@ def main():
|
|||
'__package__': None,
|
||||
'__cached__': None,
|
||||
}
|
||||
runctx(code, globs, None, options.outfile, options.sort)
|
||||
try:
|
||||
runctx(code, globs, None, options.outfile, options.sort)
|
||||
except BrokenPipeError as exc:
|
||||
# Prevent "Exception ignored" during interpreter shutdown.
|
||||
sys.stdout = None
|
||||
sys.exit(exc.errno)
|
||||
else:
|
||||
parser.print_usage()
|
||||
return parser
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue