diff --git a/Lib/test/script_helper.py b/Lib/test/script_helper.py --- a/Lib/test/script_helper.py +++ b/Lib/test/script_helper.py @@ -27,16 +27,20 @@ def _assert_python(expected_success, *ar # site-packages, and don't add the current directory to sys.path cmd_line.append('-I') elif not env_vars: # ignore Python environment variables cmd_line.append('-E') # Need to preserve the original environment, for in-place testing of # shared library builds. env = os.environ.copy() + # set TERM='' unless the TERM environment variable is passed explicitly + # see issues 11390 and 18300 + if 'TERM' not in env_vars: + env['TERM'] = '' # But a special flag that can be set to override -- in this case, the # caller is responsible to pass the full environment. if env_vars.pop('__cleanenv', None): env = {} env.update(env_vars) cmd_line.extend(args) p = subprocess.Popen(cmd_line, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE,