diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2012-05-18 16:33:07 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2012-05-18 16:33:07 (GMT) |
commit | ebdcd859e59ed16a79dea94291c0be3a87640a08 (patch) | |
tree | 4f91f5ec40375ba9bbdfacc2da79dd31bc440f89 /Lib/multiprocessing/util.py | |
parent | 77c84f2defb0013e28d262be237142379a1407fe (diff) | |
download | cpython-ebdcd859e59ed16a79dea94291c0be3a87640a08.zip cpython-ebdcd859e59ed16a79dea94291c0be3a87640a08.tar.gz cpython-ebdcd859e59ed16a79dea94291c0be3a87640a08.tar.bz2 |
Move private function _args_from_interpreter_flags() to subprocess.py, so
that it can be imported when threads are disabled.
(followup to issue #12098)
Diffstat (limited to 'Lib/multiprocessing/util.py')
-rw-r--r-- | Lib/multiprocessing/util.py | 30 |
1 files changed, 1 insertions, 29 deletions
diff --git a/Lib/multiprocessing/util.py b/Lib/multiprocessing/util.py index 7c71081..cbb01c9 100644 --- a/Lib/multiprocessing/util.py +++ b/Lib/multiprocessing/util.py @@ -14,6 +14,7 @@ import weakref import atexit import threading # we want threading to install it's # cleanup function before multiprocessing does +from subprocess import _args_from_interpreter_flags from multiprocessing.process import current_process, active_children @@ -297,32 +298,3 @@ class ForkAwareLocal(threading.local): def __reduce__(self): return type(self), () -# -# Get options for python to produce the same sys.flags -# - -def _args_from_interpreter_flags(): - """Return a list of command-line arguments reproducing the current - settings in sys.flags and sys.warnoptions.""" - flag_opt_map = { - 'debug': 'd', - # 'inspect': 'i', - # 'interactive': 'i', - 'optimize': 'O', - 'dont_write_bytecode': 'B', - 'no_user_site': 's', - 'no_site': 'S', - 'ignore_environment': 'E', - 'verbose': 'v', - 'bytes_warning': 'b', - 'quiet': 'q', - 'hash_randomization': 'R', - } - args = [] - for flag, opt in flag_opt_map.items(): - v = getattr(sys.flags, flag) - if v > 0: - args.append('-' + opt * v) - for opt in sys.warnoptions: - args.append('-W' + opt) - return args |