diff --git a/Lib/test/test_cmd_line.py b/Lib/test/test_cmd_line.py --- a/Lib/test/test_cmd_line.py +++ b/Lib/test/test_cmd_line.py @@ -270,8 +270,12 @@ self.assertEqual(out1, out2) def test_displayhook_unencodable(self): + # This test involves an environment variable, this means that + # it can't, by definition not use the '-E' or '-I' executable + # parameters. And hence, can't use script_helper.spawn_python for encoding in ('ascii', 'latin-1', 'utf-8'): - env = os.environ.copy() + env = {key:value for (key,value) in os.environ.copy().items() + if not key.startswith('PYTHON')} env['PYTHONIOENCODING'] = encoding p = subprocess.Popen( [sys.executable, '-i'],