mirror of
https://github.com/python/cpython.git
synced 2025-08-27 20:25:18 +00:00
bpo-32094: Update subprocess for -X dev (#4480)
Modify subprocess._args_from_interpreter_flags() to handle -X dev option. Add also unit tests for test.support.args_from_interpreter_flags() and test.support.optim_args_from_interpreter_flags().
This commit is contained in:
parent
423fd362f8
commit
f39b674876
2 changed files with 79 additions and 2 deletions
|
@ -260,8 +260,29 @@ def _args_from_interpreter_flags():
|
|||
v = getattr(sys.flags, flag)
|
||||
if v > 0:
|
||||
args.append('-' + opt * v)
|
||||
for opt in sys.warnoptions:
|
||||
|
||||
# -W options
|
||||
warnoptions = sys.warnoptions
|
||||
xoptions = getattr(sys, '_xoptions', {})
|
||||
if 'dev' in xoptions and warnoptions and warnoptions[-1] == 'default':
|
||||
# special case: -X dev adds 'default' to sys.warnoptions
|
||||
warnoptions = warnoptions[:-1]
|
||||
for opt in warnoptions:
|
||||
args.append('-W' + opt)
|
||||
|
||||
# -X options
|
||||
if 'dev' in xoptions:
|
||||
args.extend(('-X', 'dev'))
|
||||
for opt in ('faulthandler', 'tracemalloc', 'importtime',
|
||||
'showalloccount', 'showrefcount'):
|
||||
if opt in xoptions:
|
||||
value = xoptions[opt]
|
||||
if value is True:
|
||||
arg = opt
|
||||
else:
|
||||
arg = '%s=%s' % (opt, value)
|
||||
args.extend(('-X', arg))
|
||||
|
||||
return args
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue